frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

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?

Reddit stock drops almost 6%, Meta launches standalone app for online forums

https://www.cnbc.com/2026/05/22/reddit-stock-drops-after-meta-launches-forum-app.html
1•1vuio0pswjnm7•59s ago•0 comments

Cleaning Station

https://en.wikipedia.org/wiki/Cleaning_station
1•pvillano•3m ago•1 comments

The phrase "taste is the differentiator" is not beneficial

https://hazn.com/please-stop-repeating-is-the-differentiator
1•hazn•4m ago•0 comments

Fauxx – Data poisoning for your everyday tracking

https://github.com/digital-grease/fauxx
1•vidyesh•6m ago•0 comments

Amazon Web Services – Four Years and Out

https://www.adventuresinoss.com/aws-four-years/
1•RyeCombinator•8m ago•0 comments

What does grep stand for, and the 75 year history of the regular expression

https://mart.traagel.dev/blog/what-does-grep-stand-for/
1•sonabinu•11m ago•0 comments

Commodity Intelligence

https://contraptions.venkateshrao.com/p/commodity-intelligence
1•swolpers•11m ago•0 comments

British power prices are increasingly independent from gas

https://ember-energy.org/latest-insights/british-power-prices-are-increasingly-independent-from-gas/
1•helsinkiandrew•19m ago•0 comments

Show HN: Qavvali Wiki

https://www.qavvali.com/
1•vishkk•19m ago•0 comments

Show HN: Panorama – Review Code, Faster

https://panorama.stagas.deno.net/
1•stagas•20m ago•0 comments

The C++ Standard Library Has Been Walking Itself Back for Fifteen Years

https://hftuniversity.com/post/the-c-standard-library-has-been-walking-itself-back-for-fifteen-ye...
1•alexjurkiewicz•25m ago•0 comments

Their Phones Were Stolen in London. Then the Threats Started

https://www.nytimes.com/2026/05/23/world/europe/phone-theft-threats-london.html
2•0in•30m ago•0 comments

Easier bets to get early customer validation and VC attention

1•Notional_ID•32m ago•0 comments

Pre-ASI Society

https://lifearchitect.ai/wiki/
1•adt•35m ago•0 comments

Export chats from 11 AI platforms to PDF or Markdown locally

https://chromewebstore.google.com/detail/ai-chat-exporter-sharer-p/eamemmejpblbiapnigdimieiblldhgoi
1•Rocke1001feller•36m ago•3 comments

'Fuck you, Bambu': How one private message could change the face of 3D printing

https://www.theverge.com/tech/931532/bambu-agpl-pawel-jarczak-open-source-threat-dmca-github
4•tambourine_man•37m ago•0 comments

When Was the First Islamic Voyage to the Americas?

https://lostfutures.substack.com/p/when-was-the-first-islamic-voyage
2•Lost-Futures•38m ago•0 comments

Family wanted to start over. They're building opt-in village for anyone to apply [video]

https://www.youtube.com/watch?v=5hiLNnzbj8o
2•surprisetalk•39m ago•1 comments

Human Bottlenecks

https://borretti.me/article/human-bottlenecks
3•zdw•40m ago•0 comments

Who Builds a House Without Drawing Blueprints? (2015)

https://cacm.acm.org/opinion/who-builds-a-house-without-drawing-blueprints/
1•zdw•41m ago•0 comments

Why Is Vivado 2026.1 Dropping Linux Support for Free Tier?

https://adaptivesupport.amd.com/s/question/0D5Pd00001YQLdMKAX/why-is-vivado-20261-dropping-linux-...
12•zdw•44m ago•0 comments

The C64 Dead Test Font

https://www.masswerk.at/nowgobang/2026/c64-dead-test-font
3•masswerk•1h ago•0 comments

The Random Camera Shop Discovery That Inspired Star Wars' Lightsaber Design

https://www.bgr.com/2143613/star-wars-lightsaber-design-inspiration-camera-shop-discovery/
1•gnabgib•1h ago•0 comments

All the Star Wars Lightsaber Designs

https://kottke.org/26/05/all-the-star-wars-lightsaber-designs
1•vinhnx•1h ago•1 comments

How a fake investigation into India, Myanmar rebels went around the world

https://www.altnews.in/the-conspiracy-that-wasnt-how-a-fake-investigation-into-india-myanmar-rebe...
1•thunderbong•1h ago•0 comments

AI as a Design Medium

https://www.harvarddesignmagazine.org/articles/ai-as-a-design-medium-rodenbeck/
1•vinhnx•1h ago•0 comments

Scam calls hunt the lonely, not the gullible

https://pilgrimsage.substack.com/p/the-faceless-voice
2•momentmaker•1h ago•0 comments

Base Fatality List

https://bfl.baseaddict.com/
4•OsrsNeedsf2P•1h ago•0 comments

Investigating Trump's Stock Trades and Public Announcement Timings [video]

https://www.youtube.com/shorts/LEIn9wHJTbw
1•Cider9986•1h ago•0 comments

Syllaby

https://syllaby.io/
1•Austinrmstrong•1h ago•0 comments