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?

Two Singaporean brothers turns unsolvable math into post-quantum encryption

https://startupfortune.com/two-singaporean-brothers-turned-unsolvable-math-into-southeast-asias-f...
1•insanetech•1m ago•0 comments

Show HN: Ziex, a Zig web framework reaching its first release

1•nurulhudaapon•2m ago•0 comments

Moebius: 0.2B image inpainting model with 10B-level performance

https://hustvl.github.io/Moebius/
1•DSemba•2m ago•0 comments

Trump unveiled Qatar's gifted Air Force One this week

https://respublica.media/en/trump-unveiled-qatars-gifted-air-force-one-this-week/
3•Veldoran•2m ago•0 comments

Tesla driver says it was on Autopilot before fatal Texas home crash

https://electrek.co/2026/06/20/tesla-autopilot-katy-texas-home-crash-woman-killed/
2•croes•2m ago•0 comments

AI Is Boosting Productivity at Home – But Not Equally

https://www.marshall.usc.edu/news/new-research-reveals-ai-is-boosting-productivity-at-home--but-n...
1•giuliomagnifico•2m ago•0 comments

Alan Greenspan's Essay: "Gold and Economic Freedom"

https://ritholtz.com/2008/11/gold-and-economic-freedom-by-alan-greenspan/
1•bhouston•3m ago•0 comments

Ask HN: Is there still value in making apps?

1•darth-pixit•3m ago•0 comments

AI effect: People are taking up skills for no money, just to feel human

https://siliconcanals.com/m-as-ai-eats-into-paid-creative-work-people-are-taking-up-the-same-skil...
1•achow•3m ago•1 comments

China Became an Energy Superpower [video]

https://www.youtube.com/watch?v=xCUASv01bVY
1•hunglee2•5m ago•0 comments

Robotic exoskeleton could redefine how stroke survivors relearn to walk

https://news.northwestern.edu/stories/2026/06/new-exoskeleton-therapy-could-redefine-how-stroke-s...
1•gmays•5m ago•0 comments

Polaris: A Native macOS App for Kamal

https://polaris-deploy.com/
1•thunderbong•5m ago•0 comments

Hacker News Games in Videos

https://video.intellios.ai/
1•coolwulf•5m ago•0 comments

Extreme Dynamic Symmetry Enables Omnidirectional and Multifunctional Robots

https://generalroboticslab.com/Argus
1•speckx•5m ago•0 comments

Fungus-Growing Ants

https://en.wikipedia.org/wiki/Fungus-growing_ants
1•CGMthrowaway•6m ago•0 comments

AI will create more jobs for humans, not replace them, says Bezos

https://www.bbc.com/news/articles/ceqdrw2yy3vo
2•heyitssim•7m ago•0 comments

QSOE: QNX-inspired OS with dual-kernel architecture

https://qsoe-dev.blogspot.com/2026/06/qsoe-project-v01-is-released.html
1•ymz5•8m ago•0 comments

Never Give Them Your Face

https://nevergivethemyourface.com/
3•audiodude•9m ago•0 comments

Former Unreal Engine 'Lead Evangelist' Sjoerd De Jong Leaves Epic Games

https://www.pcgamer.com/gaming-industry/former-unreal-engine-evangelist-and-level-design-legend-s...
1•Michelangelo11•9m ago•0 comments

Show HN: GeoTag Photos – Add GPS coordinates to photos in the browser

https://geotagphotos.app
1•zylics•9m ago•0 comments

Why European housing politics should be Americanized

https://worksinprogress.co/issue/should-european-housing-politics-be-americanized/
1•surprisetalk•9m ago•0 comments

Retrieval Debt: The Technical Debt Your Agent Is Paying

https://sohit.substack.com/p/retrieval-debt-the-technical-debt
2•sohitkeshri•10m ago•0 comments

The Coming Enshittification of AI

https://www.damianmr.com/posts/the-coming-enshittification-of-ai
2•Pattaya•10m ago•0 comments

Have Data Centers Raised Your Electric Bill? Causal Evidence from the US

https://arxiv.org/abs/2606.19777
2•atlasunshrugged•10m ago•1 comments

DNA from 2k-year-old grape seeds points to origins of modern winemaking

https://www.theguardian.com/world/2026/jun/14/dna-from-2000-year-old-grape-seeds-points-to-origin...
1•speckx•10m ago•0 comments

Keogram: The Sky in 2025

https://apod.nasa.gov/apod/ap260621.html
1•mef51•11m ago•0 comments

Chevron signs 20-year power agreement with Microsoft for West Texas data center

https://www.chevron.com/newsroom/2026/q2/chevron-signs-20-year-power-agreement-with-microsoft-for...
1•cdrnsf•11m ago•0 comments

Is Time Slowly Dying?

https://www.facebook.com/share/r/1CfnJ9UQoT/
1•Asheed•12m ago•0 comments

Pledging Another $400k to the Zig Software Foundation

https://mitchellh.com/writing/zig-donation-2026
13•tosh•12m ago•0 comments

Domain Understanding Is Moat

https://sohit.substack.com/p/domain-understanding-in-moat
2•sohitkeshri•13m ago•0 comments