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

Earendil Inc. announcing Pi acquisition and Lefos

https://earendil.com/posts/press-release-april-8th/
1•czottmann•33s ago•0 comments

Show HN: DryRun – PostgreSQL MCP and schema advisor that works offline

https://github.com/boringSQL/dryrun
1•radimm•2m ago•0 comments

Mamba-3 and the State Space Model Renaissance

https://ngrislain.github.io/blog/2026-3-29-reading-note-mamba3-and-the-state-space-model-renaissa...
1•ngrislain•4m ago•0 comments

Zapfino, the Typeface with Built-In Magic

https://thatkeith.com/articles/zapfino-the-typeface-with-built-in-magic/
1•arm•4m ago•0 comments

Grid Battery storage is now cheap enough to unleash India's full solar potential

https://ember-energy.org/latest-insights/battery-storage-is-now-cheap-enough-to-unleash-indias-fu...
2•alephnerd•6m ago•0 comments

Reddit vs. SerpApi et al.

https://www.documentcloud.org/documents/26193527-reddit-v-serpapi-et-al/
2•doener•7m ago•0 comments

The Age-Old Urge to Destroy Technology

https://www.newyorker.com/culture/infinite-scroll/the-age-old-urge-to-destroy-technology
1•chrisaycock•10m ago•0 comments

Richard Feldman: language runtime overhead (2022) [video]

https://vimeo.com/653510682
1•tosh•12m ago•0 comments

Show HN: I built an open protocol for Agent-to-agent commercial negotiation

https://a2cn.io/
1•cmagorr1•12m ago•0 comments

Rare China visit, Taiwan's opposition leader calls for reconciliation

https://www.aljazeera.com/news/2026/4/8/on-rare-china-visit-taiwans-opposition-leader-calls-for-r...
1•_tk_•16m ago•0 comments

Did WordPress VIP leak my phone number?

https://shkspr.mobi/blog/2026/04/did-wordpress-vip-leak-my-phone-number/
1•ColinWright•17m ago•0 comments

OpenAI Codex reaches 3M weekly active users, up from 2M in under a month

https://twitter.com/thsottiaux/status/2041655710346572085
2•alecco•18m ago•0 comments

What Is a 'Cyberdeck': Meet Gen Z's New DIY Obsession

https://www.newsweek.com/what-is-a-cyberdeck-gen-zs-new-custom-computing-obsession-11787017
1•breve•20m ago•0 comments

Roc: Fast

https://www.roc-lang.org/fast
1•tosh•28m ago•0 comments

What does Lockdown Mode do to keep you safe from spyware? [video]

https://www.youtube.com/watch?v=5D3lWDUEJA8
1•skibz•35m ago•0 comments

An AI Agent. In COBOL. Yes

https://github.com/xawt/cobold-cli
2•Brosper•37m ago•0 comments

Ask HN: Is there some sort of stigma around Qubes OS on HN?

3•vntok•38m ago•3 comments

Effects of Stablecoin Yield Prohibition on Bank Lending

https://www.whitehouse.gov/research/2026/04/effects-of-stablecoin-yield-prohibition-on-bank-lending/
2•salkahfi•39m ago•0 comments

The Signature Method in Machine Learning (an interactive reading note)

https://ngrislain.github.io/blog/2026-4-6-reading-note-the-signature-method-in-machine-learning/
1•ngrislain•43m ago•0 comments

The Martians

https://en.wikipedia.org/wiki/The_Martians_(scientists)
1•tosh•45m ago•0 comments

We Got the Lithium-ion Battery (2024)

https://www.construction-physics.com/p/how-we-got-the-lithium-ion-battery
1•doener•45m ago•0 comments

Completely Private AI

https://molebieai.com/
1•Jimmy6929•47m ago•0 comments

FormTo – Open-source, self-hosted form back end

https://github.com/lumizone/formto
1•luka5184•48m ago•0 comments

Show HN: I built a Zoom alternative with 1 command

https://sfu.mirotalk.com
1•mp85•49m ago•1 comments

Starving Genies

https://tidyfirst.substack.com/p/starving-genies
1•danebalia•52m ago•0 comments

Roc

https://www.roc-lang.org/
1•tosh•53m ago•0 comments

Struggle Against the Gods

https://firstthings.com/struggle-against-the-gods/
3•marcofloriano•55m ago•0 comments

Google adopts new stance on device fingerprinting (2025)

https://www.lewissilkin.com/insights/2025/01/16/google-adopts-new-stance-on-device-fingerprinting...
1•bellwhistle•55m ago•0 comments

All of the String Types

https://lambdalemon.gay/posts/string-types
1•g0xA52A2A•57m ago•0 comments

Škoda DuoBell – The Bike Bell Designed to Penetrate Noise-Cancelling Headphones [video]

https://www.youtube.com/watch?v=zDaVPfpQvPI
1•SockThief•57m ago•1 comments