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?

A 'Zoomer-to-Boomer' Pay Phone Hotline Gets Two Generations Chatting

https://www.nytimes.com/2026/03/27/us/payphone-boston-boomer-zoomer.html
1•wallflower•44s ago•0 comments

Show HN: Ticking Away, a Dark Side of the Moon Watchface Written in Zig

https://clebert.github.io/ticking-away/
1•clebert•1m ago•0 comments

Sceye and SoftBank Test High-Altitude Platform Station

https://spectrum.ieee.org/sceye-high-altitude-platform-station
1•rbanffy•2m ago•0 comments

Digitizing photos from the 1998 Game Boy Camera

https://swiftrocks.com/digitizing-photos-from-the-1998-game-boy-camera
2•rockbruno•2m ago•0 comments

Google and Epic Games Announce Settlement – Pixel Envy

https://pxlnv.com/linklog/google-epic-games-settlement/
1•janandonly•3m ago•0 comments

Karachi leverages Iran war, wins a year's worth of transshipment in 24 days

https://asia.nikkei.com/spotlight/iran-tensions/karachi-leverages-iran-war-wins-a-year-s-worth-of...
1•rguiscard•3m ago•0 comments

Show HN: PromptLedger – local-first prompt versioning in SQLite

https://github.com/Ertugrulmutlu/promptledger
1•emut1•4m ago•0 comments

Understanding young news audiences at a time of rapid change

https://reutersinstitute.politics.ox.ac.uk/understanding-young-news-audiences-time-rapid-change
1•giuliomagnifico•4m ago•0 comments

Ukraine's military brings exoskeletons to the front line

https://www.popsci.com/technology/exoskeletons-ukraine-war/
2•doener•7m ago•0 comments

Every Reason to Hate Cars [video]

https://www.youtube.com/watch?v=umgi-CbaSRU
1•tcfhgj•9m ago•0 comments

I built a better, human like memory, for Agents

https://github.com/emson/elfmem
3•emson•9m ago•0 comments

Show HN: Sheet Ninja – Google Sheets as a CRUD Back End for Vibe Coders

https://sheetninja.io
8•sxa001•11m ago•6 comments

KDE has implemented the new Wayland session restore protocol

https://www.neowin.net/news/kde-has-implemented-the-new-wayland-session-restore-protocol/
1•bundie•18m ago•0 comments

Cloud-free Sentinel-2 Images of German administrative districts

https://gitlab.opencode.de/lgln/sentinel2l
1•slow_typist•22m ago•0 comments

Logical Intelligence: The First Energy Based Model for Critical Systems

https://logicalintelligence.com/
1•doener•22m ago•0 comments

Just released 3 examples for my native HTML/CSS UI for windows, feedback welcome

https://github.com/M4iKZ/mUI-showcase
1•M4iKZ•24m ago•1 comments

Bigoish: Test the empirical computational complexity of Rust algorithms

https://docs.rs/bigoish/latest/bigoish/
1•birdculture•28m ago•0 comments

Why free stuff makes us irrational

https://thehustle.co/why-free-stuff-makes-us-irrational
2•Anon84•28m ago•0 comments

Ramen: Relational Agentic Memory and Emergent Network

https://github.com/cachopin/ramen
1•cachopin•29m ago•0 comments

Terminal Trove

https://terminaltrove.com/explore/
4•esher•37m ago•0 comments

Will we have AGI by 2030? Are the new Formula 1 rules good? – Analyze both sides

https://99helpers.com/tools/both-sides-ai
2•nickk81•37m ago•1 comments

Show HN: Think Fu – Metacognition as a service

https://thinkfu.org
2•georgestrakhov•39m ago•0 comments

Show HN: Voxi.fm – Listen to articles that don't sound like a robot reading

https://www.voxi.fm
2•k1m•40m ago•0 comments

Coinbase brings token-backed down payments to housing market

https://www.reuters.com/technology/crypto-home-coinbase-brings-token-backed-down-payments-housing...
3•geox•42m ago•1 comments

Show HN: TurboQuant for vector search – 2-4 bit compression

https://github.com/RyanCodrai/py-turboquant
2•justsomeguy1996•42m ago•1 comments

Tracking (Expert/Influential) Predictions about AI

https://www.lesswrong.com/posts/oHSGHxhsbxN72BZ4C/tracking-expert-influential-predictions-about-ai
2•joozio•51m ago•0 comments

LinkedIn Lost in Translation: What CEOs Mean

https://www.youtube.com/watch?v=VakDdroSfCA
1•frag•56m ago•0 comments

In pictures: The changing shape of mission control

https://www.bbc.com/future/article/20260327-from-mercury-to-artemis-the-evolution-of-mission-control
1•reconnecting•1h ago•0 comments

Social Diffusion Defense

https://juliusthimm.com/
1•andytratt•1h ago•0 comments

The Greatest Deal Google Ever Made: Buying DeepMind

https://www.wsj.com/tech/ai/deepmind-google-demis-hassabis-5bd6de54
4•Anon84•1h ago•2 comments