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?

AI helped me give a better talk

https://lswith.io/posts/how-ai-helped-me-give-a-better-talk/
1•lswith•1m ago•0 comments

My ugly ahh website does what it's supposed to do [video]

https://www.youtube.com/shorts/r7wFhADaoVw
1•ourmandave•1m ago•0 comments

'Unbelievably Stupid' Tourist Charges Yellowstone Bison Herd

https://cowboystatedaily.com/2026/06/08/unbelievably-stupid-tourist-charges-yellowstone-bison-herd/
1•Bender•2m ago•0 comments

All the Ways Europe Is Ditching American Technology

https://www.wired.com/story/all-the-ways-europe-is-ditching-american-technology/
1•rawgabbit•3m ago•0 comments

FP8 Is All You Need (Part 1): Debunking Hardware FP64 as the HPC Holy Grail

https://arxiv.org/abs/2606.06510
1•matt_d•3m ago•0 comments

$100,000 fee on H-1B visas for highly skilled workers struck down in court

https://www.washingtonpost.com/business/2026/06/08/court-strike-down-trumps-h-1b-100000-fee/
1•root-parent•4m ago•0 comments

What happens when run you evals on brainrot?

https://www.scorecard.io/blog/making-research-papers-feel-brainrot-so-i-can-read-them
1•yash1hi•5m ago•0 comments

Show HN: Command Center, the AI coding env for people who care about quality

https://www.cc.dev/
1•Darmani•8m ago•0 comments

macOS app to create great app store screenshots

https://apps.apple.com/us/app/framestudio-app-screenshots/id6764189071?mt=12
1•yozat02•10m ago•0 comments

Apple's Orwellian device controls for tots also mean more work for parents

https://www.theregister.com/personal-tech/2026/06/08/apples-orwellian-device-controls-for-tots-al...
1•maguszin•13m ago•0 comments

I created a second brain for small teams that keep losing context on their plans

https://www.flowtex.xyz
1•Nicolau_Amorim•14m ago•0 comments

Building intelligent apps for Apple platform with Claude in the Foundation Model

https://claude.com/blog/claude-for-foundation-models
1•Handy-Man•14m ago•1 comments

Fog Panther – Image Editor for Linux

https://fogpanther.com/
1•dsego•14m ago•0 comments

Computer Lessons

https://technicshistory.com/2026/06/06/computer-lessons/
1•cfmcdonald•16m ago•1 comments

Listening to forests reveals signs of recovery beyond tree cover

https://news.mongabay.com/2026/04/listening-to-forests-reveals-signs-of-recovery-beyond-tree-cover/
1•PaulHoule•16m ago•0 comments

Give your friends a chance to abandon you

https://www.bitsofwonder.co/p/give-your-friends-a-chance-to-abandon
3•eatitraw•18m ago•0 comments

Freiburg-based startup, is entering the market with caloric cooling technology

https://www.ipm.fraunhofer.de/en/press-publications/press-releases/Qurie-GmbH-founding-electrocal...
2•doener•18m ago•0 comments

My Rust SIMD code was silently running as scalar Part 2

https://coloneltoad.substack.com/p/why-my-windows-benchmarks-were-lying
1•tolugenius•21m ago•0 comments

LazyWM – Tiling window manager for Windows 11 / 10

https://kojcinemir.github.io/lazywm/index.html
1•pozitronij•24m ago•2 comments

Core AI Models

https://github.com/apple/coreai-models
1•gok•27m ago•0 comments

YouTube thumbnails, titles, tags, and editable headline text in one click

https://loop-tube.com/
1•yashness•28m ago•0 comments

Animations in my Google Slides game are SUPER tedious and long

https://old.reddit.com/r/IndieDev/comments/1u0jcg8/animations_in_my_google_slides_game_are_super/
1•greazy•31m ago•0 comments

Project Brain– Persistent Second Brain for Claude Code and Windsurf, Cursor etc.

https://raw.githubusercontent.com/OoneBreath/claude-code-project-brain/main/docs/demo.gif
1•Slav_fixflex•32m ago•0 comments

Attacking Ruby on Rails Applications (2016)

https://phrack.org/issues/69/12#article
2•downbad_•32m ago•0 comments

Discover container machines – WWDC26 – Videos Developer

https://developer.apple.com/videos/play/wwdc2026/389/
2•tambourine_man•32m ago•0 comments

Brit fraudsters using AI to doctor 'evidence' in motor insurance claims

https://www.theregister.com/ai-and-ml/2026/06/08/motor-insurance-frausters-abusing-ai-to-exaggera...
1•Bender•39m ago•0 comments

The Nerdy Escorts Cashing in on Silicon Valley's AI Boom

https://www.forbes.com/sites/annatong/2026/06/07/the-nerdy-escorts-cashing-in-on-silicon-valleys-...
2•doener•39m ago•2 comments

Signal, DuckDuckGo among firms weighing Canada exit over lawful access bill

https://globalnews.ca/news/11886905/lawful-access-bill-c-22-companies-services-canada/
2•Cider9986•40m ago•0 comments

App Trust Preview – Quick Look Safety Reports for macOS Apps

https://apptrustpreview.com/
1•IGHOR•40m ago•0 comments

Python JIT compiler project under threat after steering council

https://www.theregister.com/devops/2026/06/08/python-jit-compiler-may-be-removed/5252079
1•Bender•41m ago•1 comments