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 Did Life Arise? Three Turning Points in Early Evolution

https://www.nytimes.com/2026/10/19/science/evolution-life-earth.html
1•mooreds•37s ago•0 comments

Show HN: Lights-on software factory boilerplate for Claude Code

https://github.com/gojko/lights-on-software-factory
1•gojkoa•1m ago•0 comments

Found archive.today debug dump glitch

https://nonograph.com/interesting-archivetoday-bug-10-20-2026
1•writtenone•4m ago•1 comments

Anyone migrate off Google Voice?

1•thomas536•7m ago•0 comments

Andreessen Horowitz lays off majority of portfolio recruiting team

https://www.msn.com/en-us/news/other/scoop-andreessen-horowitz-lays-off-majority-of-portfolio-rec...
3•mooreds•9m ago•0 comments

Developing Taste

https://emilkowal.ski/ui/developing-taste
1•cat-whisperer•11m ago•0 comments

Sourcey's open startup-credit registry: twelve dated records with provenance

https://sourcey.com/startup-credits
1•asporeteam•12m ago•0 comments

Ask HN: Dark mode for HN please? (2026)

2•Stitch4223•13m ago•2 comments

Back to school for a new ABC [pdf]

https://www.researchgate.net/publication/243648836_Back_to_school_for_a_brand_new_ABC
1•jgalego•13m ago•0 comments

Show HN: A legal assistant that refuses to cite law it can't verify

https://ailegal.legal/
1•vnutrivas•14m ago•0 comments

Show HN: Self-hosted AI spend attribution

https://demo.costura.ai/overview
2•0set0set•14m ago•0 comments

Self-hosted AI spend attribution

https://github.com/CosturaAI/costura
2•cauebraz•18m ago•0 comments

The Land Within Us: How People Shape the Earth–and Are Shaped in Return

https://worldsensorium.com/the-land-within-us/
1•dnetesn•19m ago•0 comments

It Could Be Otherwise: Science in the Age of Uncertainty

https://blue-continuum.com/it-could-have-been-otherwise
1•dnetesn•20m ago•0 comments

Foreigners in CA arrested, charged with fraudulently registering/voting in US [video]

https://www.youtube.com/watch?v=jJ96lu5fmbA
2•shinryudbz•26m ago•2 comments

Evals for 3D CAD

https://www.emergentmind.com/papers/2605.28579
3•kalabrium•28m ago•0 comments

Lula supporters protest against Meta to denounce its 'electoral interference'

https://efe.com/english/latest-news/2026-10-20/lula-supporters-protest-against-meta-to-denounce-i...
3•jumpocelot•29m ago•0 comments

SeditionDAW: A free, browser based Ableton alternative

https://seditiondaw.com/
1•joanwestenberg•31m ago•0 comments

Investors temper Anthropic IPO valuation expectations over growth slowdown

https://www.reuters.com/business/finance/investors-temper-anthropic-ipo-valuation-expectations-ov...
4•xqcgrek2•33m ago•0 comments

Google's selfie video sign-in puts your face on its servers

https://proton.me/blog/google-selfie-video
6•jethronethro•41m ago•0 comments

OBSD 8

https://cdn.openbsd.org/pub/OpenBSD/8.0/ANNOUNCEMENT
2•cacilds•42m ago•0 comments

Vortex Code: one prompt, an AI software team that ships

https://spinozalabs.ai/news/introducing-vortex-code
1•Krissh_C•42m ago•0 comments

Show HN: Resourcedeck, free and open source resource and portfolio planning

https://resourcedeck.app/
1•Gshaheen•43m ago•0 comments

AI Discovery Index

https://mojodojo.io/ai-discovery-index
8•zenincognito•44m ago•2 comments

Ask HN: What Have You Built Privately with AI That You'd Like to Share?

1•erelong•45m ago•0 comments

Making DNS_Erlang Fast: Binary Tricks for the Beam

https://blog.dnsimple.com/2026/10/making-dns-erlang-fast/
1•signa11•48m ago•0 comments

Read old.reddit.com logged out, forever

5•spezmoddedjailb•50m ago•0 comments

Accused OpenAI spy had folder called "Saudi Gov Docs," FBI says

https://arstechnica.com/tech-policy/2026/10/accused-openai-spy-had-folder-called-saudi-gov-docs-f...
2•Metacelsus•54m ago•0 comments

Astronomers discover the first ever green star

https://www.space.com/astronomy/stars/astronomers-discover-the-1st-ever-green-star-a-cosmic-zombi...
1•bushwart•56m ago•1 comments

The Hugging Face Incident

https://huggingface.wtf/
1•erwald•59m ago•0 comments