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•11mo 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•11mo 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•11mo 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•11mo 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•11mo ago
Load test against a clone instead of a DB whose contents you care about?

F1 in China: I've never seen so many people in those grandstands

https://arstechnica.com/cars/2026/03/f1-in-china-ive-never-seen-so-many-people-in-those-grandstands/
1•PaulHoule•10s ago•0 comments

The agent that grows with you

https://hermes-agent.nousresearch.com/
1•sponno•11s ago•0 comments

A simple LinkedIn prospecting trick that improved our lead quality

https://www.indiehackers.com/post/a-simple-linkedin-prospecting-trick-that-improved-our-lead-qual...
1•YashNetworkHQ•2m ago•0 comments

New wave of immunotherapy is eliminating cancers

https://www.bbc.com/future/article/20260410-how-a-new-wave-of-immunotherapy-is-eliminating-cancers
1•andsoitis•2m ago•0 comments

Copilot Key on My Keyboard

https://github.com/Rast1234/copilot_key_on_my_keyboard/blob/master/README.md
1•rast1234•3m ago•0 comments

Linux 7.1 just killed one of dual-booting's biggest headaches

https://www.xda-developers.com/linux-71-just-killed-one-of-dual-bootings-biggest-headaches/
1•y1n0•4m ago•0 comments

We beat Google's zero-knowledge proof of quantum cryptanalysis

https://blog.trailofbits.com/2026/04/17/we-beat-googles-zero-knowledge-proof-of-quantum-cryptanal...
1•EvgeniyZh•4m ago•0 comments

Father of man who inspired Super Mario was also named Luigi

https://www.theguardian.com/games/2026/apr/18/super-mario-nintendo-luigi-inspiration
1•y1n0•5m ago•0 comments

Why don't we just ask AI to write assembler?

1•canterburry•5m ago•0 comments

Venture capitalist Ron Conway says he has 'rare' cancer

https://sfstandard.com/2026/04/17/ron-conway-venture-capitalist-cancer-treatment/
1•littlexsparkee•10m ago•0 comments

How do I get better at first-person shooters?

https://www.mothership.blog/how-do-i-get-better-at-first-person-shooters/
1•Julesprobably•11m ago•0 comments

Claude Didn't Write This

https://blog.mfc83.io/blog/claude-didnt-write-this/
1•afro88•12m ago•0 comments

Humanoid Half-Marathon

https://observervoice.com/beijings-humanoid-half-marathon-training-a-grueling-challenge-200020/
1•ggraphilia•23m ago•0 comments

Sequencing DNA at Home Locally on a DGX Spark and Mac Studio

https://twitter.com/sethshowes/status/2045289299269070978
1•jonbraun•23m ago•0 comments

US-sanctioned currency exchange says $15M heist done by "unfriendly stat

https://arstechnica.com/security/2026/04/russia-friendly-exchange-says-western-special-service-be...
1•joozio•25m ago•1 comments

Salesforce Headless 360. No Browser Required

https://www.salesforce.com/news/stories/salesforce-headless-360-announcement/?bc=HL
1•lifesaverluke•27m ago•0 comments

Does Your Poop Float?

https://buildojas.substack.com/p/does-your-poop-float
1•rohan_shah•28m ago•0 comments

Why don't VCs help founders prepare for failed fundraising?

https://www.23mile.com/insights/what-happens-when-founders-cant-raise-but-dont-want-to-lose-it-all
1•kayovin1•28m ago•2 comments

Deleteduser.com –A $15 PII Magnet

https://mike-sheward.medium.com/deleteduser-com-a-15-pii-magnet-c4396eb21061
3•croes•30m ago•1 comments

Show HN: PrivaKit – A zero-upload AI workspace in the browser via WebGPU

1•felixne•38m ago•0 comments

Most People Pick the Wrong Cleaning Gloves

https://www.gogonano.com/latex-pvc-or-nitrile-cleaning-gloves/?lang=en
1•kakur007•38m ago•1 comments

Category Theory Illustrated – Orders

https://abuseofnotation.github.io/category-theory-illustrated/04_order/
8•boris_m•47m ago•0 comments

Meta prepares to lay off a tenth of its workforce

https://www.thetimes.com/us/business-us/article/meta-prepares-to-lay-off-a-tenth-of-its-workforce...
1•petethomas•47m ago•0 comments

Three meningitis B cases confirmed in Dorset schools outbreak

https://www.thetimes.com/uk/healthcare/article/meningitis-outbreak-dorset-p8gsjrvx7
2•petethomas•49m ago•0 comments

Why is IPv6 so complicated?

https://github.com/becarpenter/misc/blob/main/why6why.md
21•signa11•54m ago•4 comments

Display-switch: Turn a $30 USB switch into a full-featured KVM

https://github.com/haimgel/display-switch
1•croes•55m ago•0 comments

What if database branching was easy?

https://xata.io/blog/what-if-database-branching-was-easy
1•tee-es-gee•58m ago•0 comments

Interesting Map Geometry and Mathematics

https://www.markrjohnsongames.com/2026/04/11/ultima-ratio-regum-0-11-update-57-interesting-map-ge...
1•Hooke•1h ago•0 comments

Why Companies Are Quietly Rehiring Software Engineers

https://www.youtube.com/watch?v=OFmxKgaLN80
1•deterministic•1h ago•0 comments

Microsoft Increases the FAT32 Limit from 32GB to 2TB

https://blogs.windows.com/windows-insider/2026/04/10/announcing-windows-11-insider-preview-build-...
1•jnord•1h ago•0 comments