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?

How to Choose a Translation of the Odyssey

https://gossmanster.substack.com/p/how-to-choose-a-translation-of-the
1•johngossman•1m ago•0 comments

The newest entrant in the military's launch competition isn't a launch company

https://arstechnica.com/space/2026/07/the-newest-entrant-in-the-militarys-launch-competition-isnt...
1•rbanffy•2m ago•0 comments

Seedream 5.0 Pro: ByteDance's Push Toward Controllable Image Generation

https://seedream-5.io/
1•KissSheep•2m ago•0 comments

Elroy Air to Go Public

https://elroyair.com/company/news/press-releases/elroy-air-to-go-public/
1•simonebrunozzi•4m ago•0 comments

Intelligent MFA Should Challenge Risk, Not Loyal Customers

https://fusionauth.io/blog/intelligent-mfa
1•mooreds•6m ago•0 comments

Show HN: Qodo: AI Code Review

https://marketplace.visualstudio.com/items?itemName=Codium.codium
1•aanthonymax•7m ago•0 comments

Show HN: GaziDuino – Web Arduino IDE with WebUSB/Web Serial Flashing

https://github.com/Gazi-AI/GaziDuino
1•gaziai•7m ago•0 comments

Memory for Browser Agents

https://browser-memory.com
1•gaston_francois•10m ago•0 comments

Show HN: The AI assistant for Ableton Live – Create, produce, and mix

https://vixsound.com
1•not_wowinter13•10m ago•0 comments

KillPretty Magazine Graffiti Art

https://www.flickr.com/photos/125908460@N08/
1•toomuchtodo•11m ago•1 comments

Degeneracy Is a Symptom

https://henryfudgeofficial.substack.com/p/degeneracy-is-a-symptom
2•doener•12m ago•0 comments

Repeated Deployments Across Three Cloud Providers Found the Same EU West Issue

https://webbynode.com/articles/three-independent-cloud-providers-repeatedly-exhibited-the-same-eu...
1•gsgreen•13m ago•0 comments

Show HN: Decypher-env, an RL Env for breaking AES encryption

https://github.com/juansebastianl/decypher-env
1•juansebastianl•13m ago•0 comments

Have people stopped trusting science? The data tell a surprising story

https://www.nature.com/articles/d41586-026-01977-9
2•PaulHoule•14m ago•0 comments

Dune Part Three Trailer

https://www.youtube.com/watch?v=NdvqHc56lE0
1•wslh•14m ago•0 comments

EThOS

https://ethos.bl.uk/
2•lokimedes•14m ago•0 comments

New York to ban smart glasses from all courthouses

https://www.syracuse.com/crime/2026/07/new-york-to-ban-smart-glasses-from-all-courthouses.html
2•ortusdux•15m ago•1 comments

We built and secured support agent with Vercel's eve framework

https://infisical.com/blog/eve-support-agent-zero-credentials
1•FinnLobsien•15m ago•0 comments

Getting Started with Anchor Positioning

https://www.joshwcomeau.com/css/anchor-positioning/
1•vinhnx•16m ago•0 comments

Show HN: The OWASP Top: Which Risks Can Be Automated?

https://onscanner.com/blog/owasp-top-10-for-automated-scanning
2•byteoptimizer•16m ago•0 comments

Auditory and spontaneous movement responses to music over first postnatal year

https://elifesciences.org/articles/107088
2•bookofjoe•16m ago•0 comments

Everyone gets faster. Not everyone gets more valuable

https://justinedwards.me/writing/everyone-gets-faster/
1•jedwardsdev•17m ago•1 comments

Show HN: Ring Holders Club

https://www.ringholders.club
3•pipnonsense•18m ago•0 comments

Apache Kafka Performance

https://jack-vanlightly.com/blog/2026/7/7/apache-kafka-performance-1-lingerms
1•vinhnx•20m ago•0 comments

Browser-Memory

https://github.com/browser-memory/bmem
3•browser-memory•20m ago•0 comments

Australian Councils vote for polluter-pays climate compensation fund

https://reneweconomy.com.au/its-costing-us-so-much-councils-vote-for-polluter-pays-climate-compen...
1•DamonHD•21m ago•0 comments

Farage left fighting a trash can as the UK populist's election gamble backfires

https://www.cnn.com/2026/07/09/uk/nigel-farage-special-election-bin-face-intl
3•mellosouls•21m ago•0 comments

Digital euro enters final round of EU negotiations

https://www.euronews.com/business/2026/07/09/digital-euro-enters-final-round-of-eu-negotiations
3•omblivion•22m ago•0 comments

Blog

https://danielmiessler.com/blog
2•Mr_Blank•22m ago•0 comments

Show HN: Where Were We

https://wherewerewe.app/
2•zkiihne•25m ago•0 comments