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•10mo 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•10mo 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•10mo 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•10mo 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•9mo ago
Load test against a clone instead of a DB whose contents you care about?

Treasure hunter freed after decade of refusing to reveal site of shipwreck gold

https://www.cbsnews.com/news/tommy-thompson-treasure-hunter-ship-of-gold-missing-coins-released-p...
1•rgovostes•43s ago•0 comments

Needle in the haystack: LLMs for vulnerability research

https://devansh.bearblog.dev/needle-in-the-haystack/
1•rzk•1m ago•0 comments

Universal vaccine against respiratory infections and allergens

https://med.stanford.edu/news/all-news/2026/02/universal-vaccine.html
2•phony-account•3m ago•0 comments

U+237C ⍼ Is Azimuth

https://ionathan.ch/2026/02/16/angzarr.html
1•cokernel_hacker•3m ago•0 comments

MuskMeter – Minute-by-minute Musk metrics

https://www.muskmeter.live/
1•rob•6m ago•0 comments

AI should help us produce better code

https://simonwillison.net/guides/agentic-engineering-patterns/better-code/
1•simonw•6m ago•0 comments

Cloudflare Crawl Endpoint

https://developers.cloudflare.com/changelog/post/2026-03-10-br-crawl-endpoint/
3•jeffpalmer•9m ago•0 comments

Nasdaq Partners with Kraken in Plan for 24/7 Tokenized Stock Trading

https://www.wsj.com/finance/stocks/nasdaq-partners-with-kraken-in-tokenization-push-135e8112
1•gmays•10m ago•0 comments

Hill-Climbing: Why Your AI Agent Wastes Half Its Brain Before Writing Any Code

https://twitter.com/notadamking/status/2031445395369504774
1•adamjking3•13m ago•0 comments

From millions of dollars to under a grand: The dramatic fall of the NFT

https://english.elpais.com/culture/2026-03-10/from-millions-of-dollars-to-under-a-grand-the-drama...
1•geox•14m ago•1 comments

Freedesktop Closes Controversial Age Verification API Proposal

https://linuxiac.com/xdg-age-verification-interface-proposal-closed/
2•miohtama•15m ago•0 comments

US and EU sanctions have killed 38M people since 1970 (2025)

https://www.aljazeera.com/opinions/2025/9/3/us-and-eu-sanctions-have-killed-38-million-people-sin...
1•abdelhousni•17m ago•2 comments

Enzyme as Maxwell's Demon: Steady-State Deviation from Chemical Equilibrium

https://arxiv.org/abs/2503.17584
3•PaulHoule•21m ago•0 comments

Stansted Airport starts accepting London's contactless travel tickets

https://www.ianvisits.co.uk/articles/mind-the-tap-stansted-airport-starts-accepting-londons-conta...
1•zeristor•23m ago•0 comments

Daniel Ellsberg: The Effect of Top Secret Clearance

https://wonkmonksnotes.wordpress.com/2021/04/22/daniel-ellsberg-the-effect-of-top-secret-clearance/
2•jdkee•23m ago•0 comments

X Users Find Their Real Names Are Googled After Using X Verification "Au10tix"

https://www.mintpressnews.com/x-users-find-their-real-names-are-being-googled-in-israel-after-usi...
3•miguelazo•25m ago•2 comments

Why Your Pinecone Index Keeps Breaking (and the Vector Ops Fix)

https://decompressed.io/learn/vector-ops-pinecone
1•zacole•25m ago•0 comments

Hereditary peers to be removed from Lords as bill passes

https://www.bbc.co.uk/news/articles/cdxg76rgdp7o
1•zeristor•27m ago•0 comments

Markdown Now Available on Wordpress.org

https://make.wordpress.org/meta/2026/03/03/markdown-now-available-on-wordpress-org/
1•gslin•28m ago•0 comments

Zee – Push-to-talk transcription for macOS (Pure Go, sub-second)

https://github.com/sumerc/zee
2•sumerc•29m ago•1 comments

AI Sucks at Guitar Tones

https://bahadiraydin.com/blog/ai-sucks-at-guitar-tones
1•bahadiraydin•29m ago•0 comments

Orange County homeowner says insurer used drone to inspect her roof

https://abc7.com/post/orange-county-homeowner-says-insurer-secretly-used-drone-inspect-roof/18694...
1•walterbell•29m ago•3 comments

His Mother Vanished When He Was 14. 33 Years Later, He Found Her

https://www.nytimes.com/2026/03/09/us/antonio-wiley-missing-mother-found.html
3•rmason•29m ago•1 comments

How the Eon Team Produced a Virtual Embodied Fly

https://eon.systems/updates/embodied-brain-emulation
1•EvgeniyZh•30m ago•0 comments

Om Malik – The Debt Beneath the Dream

https://om.co/2026/03/09/the-debt-beneath-the-dream/
2•rmason•31m ago•0 comments

U.S. Global War on Terror Has Taken Nearly 1M Lives (2021)

https://theintercept.com/2021/09/01/war-on-terror-deaths-cost/
9•abdelhousni•32m ago•2 comments

Olie, A global dollar account powered by USDC

https://oliecrypto.com
1•jarcer•32m ago•1 comments

Valve facing second, class-action lawsuit over loot boxes

https://www.pcgamer.com/gaming-industry/valve-facing-second-class-action-lawsuit-over-loot-boxes/
4•akyuu•32m ago•0 comments

AI is to software as power tools are to woodworking

3•danfunk•33m ago•2 comments

What it costs to run 1M image search in production

https://vecstore.app/blog/what-it-costs-to-search-1m-images
1•birdculture•34m ago•0 comments