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•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?

Guinea worm disease nears worldwide elimination, with only 10 cases in 2025

https://www.cidrap.umn.edu/dracunculiasis/guinea-worm-disease-nears-worldwide-elimination-only-10...
1•randycupertino•4m ago•0 comments

Alberta will vote on whether to remain part of Canada. What now?

https://www.bbc.com/news/articles/c809jg1gj9yo
1•tartoran•4m ago•2 comments

Polsia raised $30M; source map: fake ARR, dead users, god-mode over your company

https://zero-arr.vercel.app
5•not-chatgpt•9m ago•1 comments

Don't Roll Your Own

https://susam.net/do-not-roll-your-own.html
1•adunk•9m ago•0 comments

Memdeklaro: Open-source self-sovereign identity

https://memdeklaro.org
2•anonymous123•10m ago•0 comments

Customizing an LLM for Enterprise Software Engineering

https://arxiv.org/abs/2605.16517
2•daureg•11m ago•0 comments

Byrne's Euclid

https://www.c82.net/euclid/
2•layer8•15m ago•0 comments

SpaceX files to go public, and the math requires a little faith

https://techcrunch.com/video/spacex-files-to-go-public-and-the-math-requires-a-little-faith/
2•Timofeibu•19m ago•0 comments

Dirty Frag, Copy Fail, Fragnesia: A Worrisome Linux Security Trend

https://www.theregister.com/security/2026/05/23/dirty-frag-copy-fail-fragnesia-the-start-of-a-wor...
2•Timofeibu•20m ago•0 comments

Inside an N64 Cartridge: How the Hardware Actually Works [video]

https://www.youtube.com/watch?v=4Yix4NzRv9s
2•skibz•20m ago•0 comments

The Crypto Coin was the tell – thoughts on GSD, and it's crypto rugpull

https://vexjoy.com/posts/the-crypto-coin-was-the-tell/
2•AndyNemmity•21m ago•0 comments

The Appreciation Constituency: Land, Credit and the Politics of Protected Assets

https://americanaffairsjournal.org/2026/05/the-appreciation-constituency-land-credit-and-the-poli...
2•robocat•22m ago•0 comments

The Polyglot Protocol – senior-engineer guardrails for AI coding agents

https://github.com/sabir-gbs/the-polyglot-protocol
2•sabirsemerkant•23m ago•0 comments

GLP-1s Linked to Lower Risk of Cancer Spread in Four Tumor Types

https://www.medpagetoday.com/meetingcoverage/asco/121397
3•randycupertino•24m ago•0 comments

CA declares state of emergency as fire crews race to contain toxic chemical leak

https://www.bbc.com/news/articles/c3w2l249j8go
10•borski•25m ago•0 comments

Shamelessly vibecoded rust NTFS driver

https://github.com/christhomas/rust-fs-ntfs
2•chrisalexthomas•28m ago•0 comments

Markdown Is Not LaTeX

https://www.iconoclasts.blog/joe/markdown-is-not-latex
9•joesuf4•30m ago•4 comments

Collabora and Flipper: Opening Up the RK3576

https://www.collabora.com/news-and-blog/news-and-events/collabora-flipper-opening-up-the-rk3576.html
2•anikoghosyan•35m ago•0 comments

Strategic Thinking

https://candost.blog/newsletter/mediations-38/
3•mooreds•37m ago•0 comments

We reduced a real Node.js production Docker image from 1.2GB to 78MB

https://the-practical-developer.online/posts/docker-image-from-1gb-to-80mb/
4•milkikomasiko•38m ago•0 comments

Stripe's John Collison on How Agentic Commerce Will Reshape the Internet [video]

https://www.youtube.com/watch?v=QhGqLqCzFac
2•mooreds•39m ago•0 comments

Ricardo: On Machinery (1817)

https://www.marxists.org/reference/subject/economics/ricardo/tax/ch31.htm
2•mooreds•40m ago•0 comments

Laravel Lang packages hijacked to deploy credential-stealing malware

https://www.bleepingcomputer.com/news/security/laravel-lang-packages-hijacked-to-deploy-credentia...
2•sbulaev•40m ago•0 comments

Ask HN: How to learn how to develop real time applications?

2•creatorcoder•41m ago•0 comments

The "Single Pane of Glass" Is Dead – What Network Teams Need Is Intelligence

https://www.kentik.com/blog/the-single-pane-of-glass-is-dead-what-network-teams-actually-need-is-...
2•oavioklein•44m ago•0 comments

CodeShot – Web screenshots,scraping, and link previews for AI agents

https://drmadmeow.up.railway.app/
3•edowamba•45m ago•0 comments

Tesla now calls FSD 'Tesla Assisted Driving' in China – a more truthful name

https://electrek.co/2026/05/23/tesla-now-calls-fsd-tesla-assisted-driving-in-china-a-more-truthfu...
4•breve•46m ago•1 comments

Anthropic blames dystopian sci-fi for training AI models to act "evil"

https://arstechnica.com/ai/2026/05/anthropic-blames-dystopian-sci-fi-for-training-ai-models-to-ac...
4•rbanffy•48m ago•4 comments

Moment SpaceX rocket explodes in the Indian Ocean after splashdown

https://www.bbc.co.uk/news/videos/c1728ypp15no
3•ColinWright•49m ago•0 comments

The Next Level of Software Abstraction

https://gpeake.com/blog/abstraction
2•gepeake•52m ago•0 comments