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?

'Humanizer' tool can erase signs of AI-written text

https://www.nature.com/articles/d41586-026-02105-3
2•gnabgib•1m ago•0 comments

I Built the Ωmega Agent

https://omegas.dev
2•LivingGlitcher•2m ago•1 comments

NPM 12 makes install scripts, Git, and remote-url dependencies opt-in by default

https://github.blog/changelog/2026-07-08-npm-install-time-security-and-gat-bypass2fa-deprecation/
2•slymax•9m ago•0 comments

Cancer cases worldwide are expected to soar in the coming decades

https://www.washingtonpost.com/health/2026/07/08/why-who-is-warning-about-escalating-cancer-rates...
2•brandonb•9m ago•0 comments

Waymo Calls Police on Teenage Riders Who Were Drinking

https://www.roadandtrack.com/news/a71866405/waymo-robotaxi-calls-police-on-teenage-passengers-dri...
2•kerim-ca•13m ago•1 comments

Top Legal Adviser to Joint Chiefs Is Stepping Down a Year Before Completing Term

https://www.propublica.org/article/eric-widmar-retiring-joint-chiefs-legal-adviser
3•Jimmc414•14m ago•0 comments

Practical Lessons from Reinforcement Learning Post Training Experiments [pdf]

https://zenodo.org/records/21115798
2•luvverma2011•15m ago•0 comments

China Cuts 12,200 University Programs, Replaces Many with AI Degrees

https://www.forbes.com/sites/annaesakismith/2026/06/23/china-cuts-12200-university-programs-repla...
3•happy-go-lucky•21m ago•0 comments

Non-tech background, choosing between using CLaudeCode and CodeX

2•virtuallymundo•22m ago•0 comments

Texans deserve more then a Ken Paxton snake game

https://paxtonsnake.3d2k.com/
2•KilledByAPixel•24m ago•1 comments

Show HN: Figment – An AI that I made my friends talk to for 2 weeks

https://figment.computer/
2•subby•26m ago•0 comments

Burner Email, Temp email Box lasting 24 hours

https://burneremail24.com/
2•texasjosh•26m ago•0 comments

Llama 2 LLM on DOS (2025)

https://yeokhengmeng.com/2025/04/llama2-llm-on-dos/
2•userbinator•26m ago•0 comments

Rutazo – Argentina's freight marketplace, built solo in 4 months

https://www.rutazo.com
1•cookinat•26m ago•0 comments

Citicorp Center Engineering Crisis

https://en.wikipedia.org/wiki/Citicorp_Center_engineering_crisis
2•thunderbong•28m ago•1 comments

What's slowing down the AI buildout

https://www.worksinprogress.news/p/ai-is-bottlenecked-by-the-grid
1•droidjj•31m ago•0 comments

Researchers uncover possible cause of muscle pain from cholesterol medication

https://medicalxpress.com/news/2026-07-uncover-muscle-pain-widely-cholesterol.html
2•brandonb•34m ago•0 comments

Show HN: Free and OSS way to extend client-facing functionality of Linear

https://linear.gratis/
1•gvlachos•37m ago•0 comments

AI could keep poor countries poor

https://newsletter.deenamousa.com/p/ai-could-keep-poor-countries-poor
2•zaik•37m ago•0 comments

Morph Chess

https://www.david-duval.com/morph-chess/
1•dvduval•39m ago•1 comments

Looksmaxxing influencer who fled police found dead

https://thetab.com/2026/07/08/looksmaxxing-influencer-who-fled-police-found-dead-after-swimming-n...
2•andsoitis•40m ago•0 comments

Character AI Alternative for Roleplay

https://chatbrat.ai/bratlog/best-character-ai-alternatives-2026
1•henrypissler•41m ago•0 comments

The library of lost journals 603 pages novel fiction book

https://play.google.com/store/books/details/The_Library_of_Lost_Journals_The_Archivist_s_Journ?id...
1•mjbachhav•44m ago•0 comments

DDB: Source-Level Interactive Debugging for Distributed Applications

https://arxiv.org/abs/2607.06107
1•Jimmc414•44m ago•0 comments

Ask HN: How to recover from thin content or de-indexing penalty on Google

2•anitroves•45m ago•2 comments

Meta Patents AI Device That Tracks Your Emotions, Watches You Take Your Meds

https://www.404media.co/meta-patents-ai-device-that-tracks-your-emotions-watches-you-take-your-meds/
4•Jimmc414•45m ago•0 comments

Counterfeit Air-Bags Are Killing U.S. Drivers–and the Government Can't Stop It

https://www.wsj.com/business/autos/counterfeit-air-bag-parts-deaths-regulators-6eddfdd4
2•fortran77•46m ago•1 comments

Ergo: Long Form Philosophy Lectures

https://ergo.org/
3•agnishom•49m ago•0 comments

Neuromancer (TV Series) – IMDB

https://www.imdb.com/title/tt31512174/
1•evo_9•53m ago•0 comments

Two teens learn the hard way not to do toy gun drive-bys from a Waymo

https://arstechnica.com/cars/2026/07/two-teens-learn-the-hard-way-not-to-do-toy-gun-drivebys-from...
1•gbourne1•1h ago•2 comments