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

Oral Argument Preview: Chatrie vs. United States

https://www.lawfaremedia.org/article/oral-argument-preview--chatrie-v.-united-states
1•hn_acker•26s ago•0 comments

Why BookScan Is Different from Book Sales (Different from Royalty Statements)

https://countercraft.substack.com/p/why-bookscan-is-different-from-book
1•crescit_eundo•1m ago•1 comments

AI Progress doesn't feel as fast as we're told

https://backnotprop.com/blog/ai-progress-doesnt-feel-as-fast-as-were-told/
1•ramoz•1m ago•0 comments

Is code quality and design systems the new SWE?

https://old.reddit.com/r/cscareerquestions/comments/1sukvlf/is_learning_code_quality_and_design_s...
1•SantiDev•4m ago•1 comments

Tiny 1000bhp 13Kg YASA Motor Cuts 200kg from EVs [video]

https://www.youtube.com/watch?v=B2Hl4c1iZK0
1•Lio•4m ago•0 comments

Tenth Circuit Broadens CFAA 'Loss' Beyond Technological Harm–Moxie vs. Nielsen

https://blog.ericgoldman.org/archives/2026/04/tenth-circuit-broadens-cfaa-loss-beyond-technologic...
1•hn_acker•5m ago•0 comments

Rust-coreutils – Program Security Assesment [pdf]

https://github.com/Zellic/publications/blob/master/uutils%20coreutils%20-%20Zellic%20Audit%20Repo...
1•delamon•5m ago•1 comments

Build Your Own Trust Chain

https://blog.certisfy.com/2026/04/build-your-own-trust-chain.html
1•Edmond•6m ago•0 comments

Google plans to invest up to $40B in Anthropic

https://www.reuters.com/business/google-plans-invest-up-40-billion-anthropic-bloomberg-news-repor...
2•wslh•6m ago•0 comments

The Atlas of AI Interaction Design

https://ai-interaction.com/
1•laurex•6m ago•0 comments

Firebird Web Client – open-source, browser-based IDE for Firebird databases

https://github.com/ZlatanOmerovic/firebird-web-client
1•mariuz•8m ago•0 comments

Age checks could turn internet into an ID checkpoint, complains Proton CEO

https://www.theregister.com/2026/04/23/proton_ceo_age_checks_id_checkpoint/
2•Bender•9m ago•1 comments

Ask HN: Any Niantic engineers or staff here who can help me?

1•jedberg•9m ago•0 comments

Tell HN: Anthropic won't reset usage limits for those who downgraded

1•vintagedave•10m ago•0 comments

Designing a Memory System for LLM-Based Agents

https://zby.github.io/commonplace/notes/designing-agent-memory-systems/
1•thomasweiser•10m ago•0 comments

Weak security means attackers could disable all of a city's public EV chargers

https://www.theregister.com/2026/04/24/rentable_iot_security_flaws/
4•Bender•10m ago•0 comments

Intel Binary Optimization: Worth it for the few?

https://www.lttlabs.com/articles/2026/04/24/intel-binary-optimization-worth-it
2•LabsLucas•10m ago•1 comments

Use of AI in Indian elections (2026)

https://www.channelnewsasia.com/asia/india-state-elections-ai-use-campaigning-6063751
2•debarshri•12m ago•0 comments

Show HN: Rook, a macOS notes app for developers

2•maryamtb•12m ago•0 comments

Plants Can Hear the Sound of Falling Rain

https://nautil.us/plants-can-hear-the-sound-of-falling-rain-1280186
2•Brajeshwar•12m ago•0 comments

As electric aspirations fade, Porsche sells its stake in Bugatti

https://arstechnica.com/cars/2026/04/as-electric-aspirations-fade-porsche-sells-its-stake-in-buga...
2•Bender•13m ago•0 comments

Styxx – text-only drift detector 0.916 AUC beats hidden-state baseline

https://github.com/fathom-lab/styxx
2•fathomlab•13m ago•0 comments

StreamComments lets you read and write comments while watching Netflix

https://chromewebstore.google.com/detail/streamcomments/bjpolkbchhpfmmiljggomjpojhigkebg
2•sandebert•19m ago•0 comments

Machine learning& gut microbiome pathway analysis in Alzheimer's risk prediction

https://alz-journals.onlinelibrary.wiley.com/doi/10.1002/dad2.70340
2•bookofjoe•20m ago•0 comments

SDL Now Supports DOS

https://github.com/libsdl-org/SDL/pull/15377
2•Jayschwa•20m ago•0 comments

Show HN: MR Links – Inline link references for Marginal Revolution blog posts

https://github.com/donchuru/mr-links
2•nanfinitum•21m ago•0 comments

Show HN: Turn speech into text anywhere via hotkey (runs on Intel NPU, no cloud)

https://github.com/anubhavgupta/whisper-npu
3•anubhav200•22m ago•4 comments

I Turned the Game Boy Color into a Watch

https://www.youtube.com/watch?v=gTUg_NePXy8
2•mehackernewsacc•22m ago•0 comments

Cloud Functions in Firebase now supports Dart as an experimental feature

https://twitter.com/Firebase/status/2047405653879070917
2•nostromoWOWWOW•22m ago•0 comments

Diatec, known for its mechanical keyboard brand FILCO, has ceased operations

https://gigazine.net/gsc_news/en/20260424-filco-diatec/
3•gslin•24m ago•0 comments