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?

Gatwick Airport left without running water at both terminals

https://www.bbc.com/news/articles/cdew2dnxlzzo
1•bookofjoe•6m ago•0 comments

This July I Was Fired from Simple AI (A Deeply YC Company)

https://andys.blog/this-july-i-was-fired-from-simple-ai/
2•andytratt•6m ago•0 comments

Welcome to the age of decadence without pleasure

https://www.theguardian.com/us-news/ng-interactive/2026/jul/26/age-of-decadence-pleasure-ai
1•n1b0m•6m ago•0 comments

Ask HN:Anyone know a good AI slop detection service.

2•boveyking•11m ago•0 comments

Climate change is now threatening a pillar of childhood: summer break

https://www.npr.org/2026/07/26/nx-s1-5900911/wildfire-smoke-fires-camp-minnesota
3•geox•13m ago•0 comments

Van freed after two years trapped in automated car park (2025)

https://www.bbc.com/news/articles/c20z46p0p6jo
1•starkparker•14m ago•0 comments

Malicious sites use JavaScript to build malware in browser memory

https://www.bleepingcomputer.com/news/security/malicious-sites-use-javascript-to-build-malware-in...
2•Brajeshwar•14m ago•0 comments

Roast My Startup (thebuildnation.com)

1•Guru_Raj•15m ago•0 comments

Agent Harness Design for Claude

https://claude.com/blog/harnessing-claudes-intelligence
1•ankitg12•15m ago•0 comments

Are we all programmers now? We Replaced the Build Layer, Not the Runtime

https://ibrahimcesar.cloud/blog/we-replaced-the-build-layer-not-the-runtime/
1•ibrahimcesar•17m ago•0 comments

Show HN: Cookbook AI – turn scattered recipe files into a print-ready cookbook

https://cookbookai.io/index.html
2•bookletaitcv1re•22m ago•0 comments

Make an Origami Circuit Board

https://spectrum.ieee.org/origami-circuit-boards
4•ohjeez•24m ago•0 comments

Terminal-native music and video player

https://github.com/dangerous-person/dopogoto-terminal-player
2•jimsojim•25m ago•0 comments

Show HN: CheapSecurity – Lightweight, Self-Hosted CCTV for Linux SBCs

https://github.com/gmrandazzo/CheapSecurity
5•zeldone•27m ago•0 comments

Show HN: A client side PDF and article reader backed by Google Drive

https://pdf-reader-peach.vercel.app/
2•northfield27•27m ago•0 comments

Ask HN: Is an in-page speed reader useful?

2•jvbotelho•27m ago•2 comments

We Are Not Special (2021)

https://www.hillelwayne.com/post/we-are-not-special/
3•birdculture•27m ago•0 comments

Design Is Compromise

https://stephango.com/design-is-compromise
12•ankitg12•29m ago•0 comments

Who's afraid of open source AI?

https://www.youtube.com/watch?v=siy0744Ykys
2•frag•31m ago•0 comments

Tools and Rituals for Reflecting

https://ask.metafilter.com/254216/What-are-your-tools-and-rituals-for-reflecting-on-the-past-year
2•ankitg12•32m ago•0 comments

DROS-VEP – A <1μs C-ABI binary circuit breaker for AI agents

https://github.com/Top-Celestial-Company-Ltd/DROS-VEP-lite
3•dros_jimmy•34m ago•0 comments

Car Plows into Crowd at Berlin Pride Event in Suspected Terror Attack

https://www.nytimes.com/2026/07/25/world/europe/berlin-car-attack.html
3•whack•35m ago•3 comments

What Sam Altman will tell the White House this week

https://www.axios.com/2026/07/26/sam-altman-openai-trump-white-house-visit?mrfcid=202607266a5afa4...
3•flurly•40m ago•0 comments

Iran calls Ukraine's strikes on Iranian vessels 'hostile and criminal'

https://www.cnbc.com/2026/07/26/ukraine-strikes-iranian-vessels-tehran-accuses-kyiv-of-hostile-ac...
3•MilnerRoute•41m ago•0 comments

Why Los Angeles Stopped Repaving Its Streets

https://www.city-journal.org/article/los-angeles-streets-repaving-disability-rules
3•toomanyrichies•42m ago•0 comments

108 PRs in eight days: Accidentally discovering loop engineering

https://brittany-ellich.offprint.app/a/3mrjj34puva23-108-prs-in-eight-days-accidentally-discoveri...
1•overcommitted•42m ago•0 comments

Canada must prepare for bigger wildfires, every summer – forever

https://www.thestar.com/news/canada/our-smoke-filled-future-how-canada-must-prepare-for-bigger-wi...
3•Teever•45m ago•2 comments

AI agents are eating the Web, growing by 8,000% and rewiring business models

https://fortune.com/2026/07/23/dead-internet-theory-bots-agents-majority-web-traffic/
3•CharlesW•50m ago•0 comments

A Love Letter to Object Orientation

https://blog.mempko.com/a-love-letter-to-object-orientation/
1•mempko•51m ago•1 comments

The Question Is the Hard Part

https://seriousmountain.substack.com/p/the-question-is-the-hard-part
1•mc-serious•51m ago•0 comments