frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Ask HN: How can I load test PostgreSQL but avoid changing actual data?

1•LawZiL•1y ago
I'm running a load test on my Node.js application and want to simulate realistic write-heavy scenarios to stress test the system — especially the PostgreSQL database.

There's a part of the code that performs UPDATE queries, but during load testing, I don't want these updates to actually change the state of the database. However, I still want the database to experience the full impact of the update — query planning, locking, I/O, WAL writes, etc. — so I can measure how it affects performance under peak load.

Is there a best-practice approach to achieve this?

So far, the most viable option I’ve found is to wrap the UPDATE queries in a transaction and then roll it back — that way, the queries still execute, but the state doesn’t change. Is this the right way to go? Does rollback introduce any performance overhead that would skew my results? Are there better or more realistic alternatives that simulate the full write path without persisting changes?

Thanks in advance!

Comments

sargstuff•1y ago
pgbench[2] / pgreplay-go[0] / python locust[1]

very old school approach:

Misuse sql VIEW[3][4] to generate a temporary parallel table setup. Testing database separate from production database would be 'better', IMHO.

-----

[0] pgreplay-go : https://github.com/gocardless/pgreplay-go

[1] python locust : https://miguel-codes.medium.com/unconventional-load-testing-...

[2] pgbench load testing :

   a) https://medium.com/@c.ucanefe/pgbench-load-test-166bdfb5c75a

   b) https://neon.tech/blog/autoscaling-in-action-postgres-load-testing-with-pgbench

   c) https://hackernoon.com/how-to-create-and-load-test-data-in-postgresql-i41e353m
----------------------------

[3] : a) https://hashrocket.com/blog/posts/materialized-view-strategi...

      b) https://tech.jonathangardner.net/wiki/PostgreSQL/Materialized_Views

      c) https://stackoverflow.com/questions/77603705/what-is-the-use-of-materialized-view-in-postgresql
[4] : https://en.wikipedia.org/wiki/View_(SQL)
LawZiL•1y ago
but again, how can i perform the query, but not actually change the state, i really need the state to keep untouched, but be able to perform the query itself.
MatthiasPortzel•1y ago
> Does rollback introduce any performance overhead that would skew my results?

I would expect it to be the other way around—since the transactions are rolled back and not committed, they would have significantly less performance impact. But I’m working from an academic model of the database.

apothegm•1y ago
Load test against a clone instead of a DB whose contents you care about?

How rogue officers turned a nationwide camera network into a tool for stalking

https://www.washingtonpost.com/technology/2026/08/02/how-police-officers-used-vast-network-camera...
1•baranul•1m ago•0 comments

Sony BMG copy protection rootkit scandal from 2005

https://en.wikipedia.org/wiki/Sony_BMG_copy_protection_rootkit_scandal
1•thinkingemote•4m ago•0 comments

Fastmail offers EU data region

https://www.fastmail.com/blog/fastmail-offers-eu-data-region/
2•jamesog•8m ago•1 comments

Show HN: ssh paint.dn.ht

1•dhotson•17m ago•0 comments

The Shape of Things to Come

https://yegge.ai/essays/the-shape-of-things-to-come/
2•tosh•18m ago•0 comments

What the Bliss Taught Us

https://daniel.haxx.se/blog/2026/08/03/what-the-bliss-taught-us/
2•robin_reala•22m ago•0 comments

I stopped trusting USB-C cable labels and started testing them

https://www.makeuseof.com/i-stopped-trusting-usb-c-cable-labels-started-testing-with-meter-instead/
2•baranul•28m ago•0 comments

Giggity – Conference Schedule Viewer

https://wilmer.gaa.st/main.php/giggity.html
1•n_plus_1_acc•28m ago•0 comments

The AI Productivity Gap

https://bjorg.bjornroche.com/management/ai-productivity-gap/
1•kiyanwang•33m ago•0 comments

Language Models Agree with Each Other, Not with Readers

https://arxiv.org/abs/2607.29274
1•sbulaev•34m ago•0 comments

Practical Memory Safety

https://ohadravid.github.io/posts/2026-08-unsafe-water/
1•jandeboevrie•38m ago•0 comments

Trust Is Gone: AI Safety Needs Individuals

https://www.lesswrong.com/posts/cm3Ea9tBHpjj9zjji/trust-is-gone-ai-safety-needs-individuals
2•joozio•38m ago•0 comments

The silent handoff of the new MCP release [video]

https://www.youtube.com/watch?v=3uOoG6rholU
3•sam_3•43m ago•0 comments

Ask HN: Do you ever think about the environmental impacts of the AI datacenters?

1•roschdal•45m ago•1 comments

Adding Go's Defer to the TypeScript Compiler

https://healeycodes.com/adding-defer-to-the-typescript-compiler
1•ingve•45m ago•0 comments

Spain's plan for the first octopus farm has been abandoned

https://www.bbc.com/future/article/20260731-spains-attempt-to-farm-octopuses-has-failed
2•geox•46m ago•0 comments

A 3-line HTML drop-in that replaces passwords with FaceID

https://nxspulse.com
1•paulnexus•49m ago•0 comments

The Framebuffer People: I Cloned Every OS on r/osdev and Found Five Real Ones

https://www.seuros.com/blog/the-framebuffer-people/
3•st_goliath•49m ago•1 comments

What Makes an Intelligence Product?

https://luntta.fi/notes/what-makes-an-intelligence-product/
1•hungryhungryhip•50m ago•0 comments

A Black woman enhanced the audio in Nolan Wells' case. People listening closely

https://thegrio.com/2026/07/28/a-black-woman-enhanced-the-audio-in-a-call-related-to-nolan-wells-...
1•baranul•50m ago•0 comments

New open sourced eval tool for building agents

1•Thomeras•51m ago•0 comments

Show HN: I created a project management system

https://is.team
1•spotlayn•53m ago•1 comments

Further Developments About Internal AI Models Hacking Things

https://thezvi.substack.com/p/further-developments-about-internal
1•thm•54m ago•0 comments

A browser-based tribute to Encarta's MindMaze

https://select.supply/game/mindmaze
1•laurentiurad•55m ago•0 comments

The Free CV Builder That Gets You Hired Faster

https://www.sartorcv.com/
1•levario•57m ago•0 comments

Rust project goals: Immobile types and guaranteed destructors

https://github.com/rust-lang/rust-project-goals/blob/main/src/2026/move-trait.md
24•paavohtl•59m ago•6 comments

Discover What Your Potential Users Are Talking About

https://agenmatic.ai/
2•Nancylily•59m ago•0 comments

MCP vs. Bash

https://pac.commonsware.com/archive/mcp-vs-bash/
1•ingve•59m ago•0 comments

Why We Stopped Making Einsteins

https://www.theintrinsicperspective.com/p/why-we-stopped-making-einsteins
1•jorzel•1h ago•0 comments

WestJet labour dispute is a proxy battle between Carney and unions

https://www.theglobeandmail.com/business/commentary/article-westjet-flight-attendant-strike-proxy...
1•petethomas•1h ago•0 comments