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

IPv8

https://openipv8.org/
1•doener•2m ago•0 comments

'Nessun Dorma': The Story Behind Pavarotti's Aria

https://www.udiscovermusic.com/classical-features/nessun-dorma-pavarotti/
1•austinallegro•2m ago•0 comments

Tencent admits GPUs only pay for themselves when powering personalized ads

https://www.theregister.com/off-prem/2026/05/14/tencent-admits-gpus-only-pay-for-themselves-when-...
1•Bender•3m ago•0 comments

Zero-day exploit defeats default Windows 11 BitLocker protections

https://arstechnica.com/security/2026/05/zero-day-exploit-completely-defeats-default-windows-11-b...
1•Bender•4m ago•0 comments

Fired hacker twins forget to end Teams recording, capture own crimes

https://arstechnica.com/tech-policy/2026/05/fired-hacker-twins-forget-to-end-teams-recording-capt...
2•Bender•4m ago•0 comments

Popish Plot

https://en.wikipedia.org/wiki/Popish_Plot
1•vinnyglennon•6m ago•0 comments

The political polarization of health outcomes in the USA

https://www.nature.com/articles/s41562-026-02474-9
1•littlexsparkee•6m ago•0 comments

Vouch-compatible PR-spam reduction GitHub Action workflow and CLI tool

https://github.com/PThorpe92/fossier
1•ellieh•8m ago•0 comments

The Revolt against I-Ready

https://www.nbcnews.com/news/education/iready-school-software-faces-parent-teacher-student-fury-r...
1•moultano•11m ago•0 comments

Scientists ID 'corkscrew killer' behind gruesome seal deaths

https://www.science.org/content/article/scientists-id-corkscrew-killer-behind-gruesome-seal-deaths
2•gmays•12m ago•0 comments

GBA Eval - Build a Game Boy Advance emulator in WebAssembly from scratch

https://gbaeval.com/
2•stared•12m ago•0 comments

A serverless image converter API using WASM on the Edge (no ImageMagick)

https://opgates.lemonsqueezy.com/checkout
1•wellscorp•14m ago•0 comments

10x more AI code is shipping on GitHub today than last year at this same time

https://loopiq.com/blog/compliance-automation
2•lkgermain•15m ago•0 comments

Subnautica 2 Early Access

https://store.steampowered.com/app/1962700/Subnautica_2/
2•accrual•17m ago•1 comments

The Worm in the Registry

https://medium.com/@vektormemory/the-worm-in-the-registry-83008d5daee0
1•vektormemory•19m ago•0 comments

Beyond C: wrapping Dear ImGui in Swift with zero FFI

https://carette.xyz/posts/swift_cpp_compatibility_with_raylib_and_imgui/
1•weird_trousers•19m ago•0 comments

Railway, Meet Milky Way: 5 Great Stargazing Trains

https://www.nytimes.com/2026/05/13/travel/stargazing-train-rides.html
1•johnbarron•19m ago•0 comments

Emodub – YouTube dubbing in your language, with emotion preserved

https://www.youtube.com/watch?v=RLWlSdf7aMQ
1•sadiuysal•21m ago•0 comments

GNUtrition 0.33.0rc2 Now Available

https://savannah.gnu.org/news/?id=10892
1•amcclure•21m ago•0 comments

Bobby Puleo 4plymag Skateboarding

https://4plymag.com/bobbypuleo/
1•marysminefnuf•27m ago•0 comments

Interactive Exploration of Scaling Options for Optical Lithography

https://www.nhurwitz.com/writing/known-scaling-options-for-euv-lithography
1•probablynoam•27m ago•0 comments

PyTorch simulator refutes an 18-year-old quantum theorem

https://github.com/lizbeth307/quantum-superactivation-refutation
1•NeoOdim•30m ago•0 comments

Court bans Kars4Kids ads in California for violating false advertising law

https://www.sfgate.com/bayarea/article/kars4kids-california-false-advertising-22259298.php
4•01-_-•31m ago•0 comments

The Interstitium, the Human Body's Hidden Pathways

https://www.nytimes.com/interactive/2026/05/11/magazine/interstitium-anatomy-acupuncture-medicine...
1•gmays•33m ago•0 comments

OVMS: Open source electric vehicle remote monitoring, diagnosis and control

https://www.openvehicles.com/home
7•BHSPitMonkey•34m ago•1 comments

Security Horror Stories

https://securityhorrors.com/
1•Einenlum•35m ago•0 comments

What's the Ideal Analogy?

https://alok.github.io/2026/04/28/whats-the-ideal-analogy/
1•yuppiemephisto•36m ago•0 comments

Godot WebGPU

https://godotwebgpu.com/
4•astlouis44•38m ago•0 comments

Show HN: Save tokens from Claude subscriptions now allowed

https://github.com/lucastononro/tiny-claude-recycler
2•ltononro•41m ago•0 comments

Interesting that Bing is down/intermittent

2•ChuckMcM•42m ago•1 comments