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?

Golden Rules for Making Money (1880)

https://www.fourmilab.ch/etexts/www/barnum/moneygetting/
1•downbad_•35s ago•0 comments

How AI Is Replacing Us and Reinventing the Way We Work as a Software Consultancy

https://upsidelab.io/blog
1•vast-alive•54s ago•0 comments

Between Clay and Light: A Quranic Framework for the Age of Intelligence

https://aliasaria.ca/posts/between-clay-and-light/
1•aliasaria•2m ago•0 comments

New Study Finds That ADHD Has 9 Categories of Symptoms

https://www.psychologytoday.com/au/blog/brain-curiosities/202604/new-study-finds-that-adhd-has-9-...
1•ivewonyoung•5m ago•0 comments

Framework 13 Pro

https://frame.work
6•simonjgreen•5m ago•0 comments

Ask HN: Can you listen to podcasts while working?

1•NourEddineX•7m ago•0 comments

Framework Laptop 13 Pro

https://frame.work/laptop13pro
4•Trollmann•7m ago•0 comments

Show HN: Muxforge Tmux Plugin Manager

https://muxforge.dev
1•techalchemist•9m ago•0 comments

Cal.diy: open-source community edition of cal.com

https://github.com/calcom/cal.diy
1•petecooper•9m ago•0 comments

Show HN: Partial-zod – streaming JSON parser for LLMs (zero deps, Zod-native)

https://github.com/miller-joe/partial-zod
1•millerjoe•9m ago•0 comments

Framework [Next Gen] Event | 2026 Launch Event[video]

https://www.youtube.com/watch?v=uqFDIR00Mwo
3•RebootStr•10m ago•0 comments

Show HN: New way to explore code in vs. code ( vs. code extension)

https://marketplace.visualstudio.com/items?itemName=AhmedRakan.structura-v2
1•araldhafeeri•13m ago•0 comments

I think the bots don't like me anymore

https://peateasea.de/i-think-the-bots-dont-like-me-anymore/
2•speckx•15m ago•0 comments

Michio Kaku "number of dead/missing American scientists "cause for natl concern"

https://www.newsweek.com/michio-kaku-dead-missing-scientists-national-concern-11849401
3•fsckboy•16m ago•0 comments

AI and the Emerging Geography of American Job Risk

https://digitalplanet.tufts.edu/ai-and-the-emerging-geography-of-american-job-risk-page/
1•rafaelc•17m ago•1 comments

Firefox Smart Window

https://www.firefox.com/en-US/smart-window/
10•shutty•22m ago•1 comments

ChatGPT Recommends the Same 3 Companies to Every B2B Buyer. Until They Specify

https://growtika.com/blog/chatgpt-b2b-persona-recommendations
4•Growtika•22m ago•0 comments

Show HN: Wreflecto – word puzzle inspired by the ancient SATOR Square

https://wreflecto.com/mirror
1•nowflux•22m ago•1 comments

'Wagyu' Used to Guarantee Quality Beef. What Are You Paying for Today?

https://www.nytimes.com/2026/04/21/dining/wagyu-beef.html
1•JumpCrisscross•22m ago•0 comments

The Bottleneck Has Moved

https://substack.com/home/post/p-193101671
1•speckx•25m ago•0 comments

CIQ Bets on Compliance: Can Linux Deliver Federal Crypto/Post-Quantum Readiness?

https://futurumgroup.com/insights/ciq-bets-on-compliance-can-enterprise-linux-really-deliver-fede...
1•losgehts•25m ago•0 comments

Software Is Speech: Why Regulators Cannot Invent the Missing Middlemen [pdf]

https://www.coincenter.org/app/uploads/2026/04/Software-is-Speech-Coin-Center.pdf
2•pr337h4m•25m ago•0 comments

Performance of the Wren Programming Language

https://wren.io/performance.html
2•fanf2•26m ago•0 comments

Show HN: A Browser Extension for Testing Content Security Policy

https://csptool.net/
1•bootbloopers•26m ago•0 comments

The Rise of CliffsNotes Cinema

https://www.theatlantic.com/culture/2026/04/book-movie-adaptation-hamlet-wuthering-heights-vibes/...
1•JumpCrisscross•26m ago•0 comments

Meta capturing employee mouse movements, keystrokes for AI training data

https://economictimes.indiatimes.com/tech/technology/meta-to-start-capturing-employee-mouse-movem...
9•dlx•27m ago•0 comments

Google Starts Scanning All Your Photos as New Update Goes Live

https://www.forbes.com/sites/zakdoffman/2026/04/20/google-starts-scanning-all-your-photos-as-new-...
4•ZeidJ•27m ago•0 comments

Show HN: Hydra – Never stop coding when your AI CLI hits a rate limit

https://github.com/saadnvd1/hydra
1•saadn92•28m ago•0 comments

Lookalike3D: Seeing Double in 3D

https://arxiv.org/abs/2603.24713
1•PaulHoule•29m ago•0 comments

Who will monetize truth? [pdf]

https://appliedxl.com/research/who-will-monetize-truth-pdf.pdf
1•JamesSebi•30m ago•0 comments