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?

QuickJS: An Embeddable JavaScript Engine

https://bellard.org/quickjs/
1•azhenley•1m ago•0 comments

Modern Design Headache: A Cerebral Basis for Visual Discomfort and Visual Stress

https://www.mdpi.com/2411-5150/10/2/34
1•rawgabbit•7m ago•0 comments

Eden Surge

https://surge.edenictech.com/
1•VictorMgaya•10m ago•0 comments

Show HN: Sanfransim.com – a long waited startup simulation game

https://sanfransim.com/
1•milkers•15m ago•0 comments

The Infrastructure Fallacy: Why Most Sales Problems Are Strategy Prob

https://medium.com/@alanscottencinas/the-infrastructure-fallacy-why-most-sales-problems-are-actua...
1•encinas88•19m ago•0 comments

RetroAchievements

https://retroachievements.org/
1•Tomte•22m ago•1 comments

Forms of life, forms of mind by Dr. Michael Levin

https://thoughtforms.life/a-talk-for-mental-health-professionals/
1•plucafs•22m ago•0 comments

I used to love Claude, but the latest models are slowly ruining it

https://www.androidauthority.com/claude-latest-models-pushback-bad-3683521/
2•Brajeshwar•22m ago•0 comments

Vector Search Is Dead

https://try.agentoid.io/
1•AlpinePrivacy•23m ago•2 comments

Balding Cure?

https://www.popularmechanics.com/science/health/a71891892/balding-cure-chinese-root/
1•donbox•25m ago•0 comments

Banning AI in Law School: We've Seen This Before

https://hardcoresoftware.learningbyshipping.com/p/240-banning-ai-in-law-school-weve
2•whobre•25m ago•0 comments

A zero-dependency Rust model that repairs code, graded by rustc

https://amalshehu.github.io/mend.rs/
1•amalshehu•25m ago•1 comments

The Montessori Method Under Scrutiny: A Meta-Analytic

https://journals.sagepub.com/doi/10.3102/00346543261458396
2•doener•30m ago•1 comments

The AI Disagreement Index: 8 models agreed on the "best tool" 0 of 16 times

https://data.deepsynthesis.org/
1•brainbootdev•31m ago•0 comments

Show HN: Ant – A JavaScript Runtime and Ecosystem

https://antjs.org
28•theMackabu•36m ago•9 comments

Show HN: Use GPT-5.6 and other models in Claude Code

https://github.com/raine/claude-code-proxy
1•rane•36m ago•0 comments

Google Maps features I want in 2026

https://www.adityakarad.com/blog/google-maps-features
1•itskarad•37m ago•1 comments

Wealthy AI workers send San Francisco house prices soaring

https://www.bbc.com/news/articles/c9q29j47v9ro
2•root-parent•37m ago•0 comments

MacSurf 2.0 for OS 9 Released

https://github.com/mplsllc/macsurf/releases
1•mplsllc•39m ago•1 comments

Show HN: Sqlsure – deterministic semantic checks for AI-generated SQL

https://github.com/sqlsure/sqlsure
2•tejusarora•40m ago•0 comments

AI Arcade – which coding model can build the best arcade game

https://ai-arcade.app
1•zapeterson16•41m ago•0 comments

Eva: Manage coding agents inside cloud connected repos

https://github.com/vvedantb/eva
1•handfuloflight•41m ago•0 comments

Nelson language for Engineers and Scientists (Matlab alternative)

https://nelson-lang.github.io/nelson-website/
1•ChaitanyaPatel•42m ago•0 comments

Sperm donors need limits, says a European fertility group

https://www.technologyreview.com/2026/07/10/1140289/sperm-donors-need-limits-says-a-european-fert...
1•randycupertino•43m ago•5 comments

Show HN: Don't let your engineering brain rot in the age of AI

https://www.30secondsofknowledge.com
2•Chipatama90•46m ago•0 comments

Too Many Books?

https://www.nytimes.com/2026/07/09/style/too-many-books-new-york-city-apartment-scholar-landlord....
1•paulpauper•47m ago•2 comments

I built a free tool to evaluate AI agent outputs (human labels and LLM judges)

https://github.com/AntoineF23/verdict
1•antoinefornas•48m ago•0 comments

What's Going on with Mental Health?

https://www.ft.com/content/063b7eed-3f13-43d4-8f12-ff6439b825e8
2•paulpauper•48m ago•2 comments

Meta's Root Cause Analysis Platform at Scale

https://engineering.fb.com/2025/12/19/data-infrastructure/drp-metas-root-cause-analysis-platform-...
1•nikolay_sivko•49m ago•0 comments

Open-Source Alternative to Buffer, Typefully, Hootsuite

https://github.com/coollabsio/shoutrrr
1•michael-sumner•49m ago•0 comments