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

How the Mind Changes

https://www.researchgate.net/publication/379760981_A_proposal_for_the_unification_of_psychotherap...
1•plucafs•1m ago•0 comments

Google employees call for military limits on AI amid Iran strikes

https://www.cnbc.com/2026/03/03/anthropic-fallout-iran-war-tech-military-ai.html
1•MilnerRoute•1m ago•0 comments

Google AI previews helped me in Iran's internet shutdown of 2025

https://ahrm.github.io/jekyll/update/2025/06/20/iran-internet-2025.html
1•owenpayton•1m ago•0 comments

Motorola GrapheneOS devices will be bootloader unlockable/relockable

https://grapheneos.social/@GrapheneOS/116160393783585567
1•pabs3•4m ago•0 comments

Developer Certificate of Origin and AI is a no-go

https://brokenco.de/2026/03/02/copyright-ai.html
1•pabs3•5m ago•0 comments

Wait what, you can't use a *code* editor when you're under 18 now?

https://mastodon.online/@marekfort/116164253291515471
1•pabs3•6m ago•0 comments

Show HN: PreflightAPI – US airports, weather, NOTAMs and more via one API

https://preflightapi.io/
1•bberisford•7m ago•0 comments

Show HN: Formualizer – Arrow-backed spreadsheet engine, 320 functions,PyO3+WASM

https://github.com/psu3d0/formualizer
1•ManfredMacx•8m ago•1 comments

Left-Handers Are More Competitive Than Right-Handers

https://www.psychologytoday.com/us/blog/the-asymmetric-brain/202602/left-handers-are-more-competi...
3•geox•10m ago•0 comments

The Markless Document Markup Standard

https://shirakumo.org/docs/markless/
1•todsacerdoti•14m ago•0 comments

People Really Are More Likely to Commit Crimes After a Cancer Diagnosis

https://www.vice.com/en/article/people-really-are-more-likely-to-commit-crimes-after-a-cancer-dia...
1•pseudolus•15m ago•0 comments

Show HN: Restless – a CLI that discovers and maps APIs automatically

https://github.com/bspippi1337/restless
1•bspippi1337•16m ago•2 comments

Four months of Ruby Central moving Ruby backward

https://andre.arko.net/2026/03/03/four-months-of-ruby-central-moving-ruby-backward/
3•bigiain•18m ago•0 comments

Trump Worries Iran's Leaders May Be Just 'As Bad' After War

https://www.bloomberg.com/news/articles/2026-03-03/trump-worries-iranian-leaders-could-be-just-as...
2•petethomas•19m ago•2 comments

Anatomy of a Web3 Supply Chain Attack

https://www.notesoncloudcomputing.com/posts/2026-02-27-anatomy-of-a-web3-supply-chain-attack/
2•carlesloriente•20m ago•0 comments

Windows 98 Disk Defrag Simulator

https://defrag98.com/
2•nixass•22m ago•1 comments

3M Canadian Adults Taking GLP-1 Drugs, Reshaping Eating and Spending Habits

https://www.thecanadianpressnews.ca/health/3m-canadian-adults-taking-glp-1-drugs-reshaping-eating...
2•karakoram•25m ago•1 comments

Claude's Cycles [pdf]

https://cs.stanford.edu/~knuth/papers/claude-cycles.pdf
1•cebert•25m ago•0 comments

Haptics: Tactile Feedback for the Mobile Web

https://haptics.lochie.me/
1•andresquez•27m ago•2 comments

Offshore Wind Turbine Will House a Data Center Underwater

https://spectrum.ieee.org/data-center-floating-wind-turbine
1•defrost•28m ago•0 comments

Intel appoints noted technologist Dr. Craig Barratt as Board achair

https://www.intc.com/news-events/press-releases/detail/1762/intel-board-chair-frank-d-yeary-to-re...
1•osnium123•33m ago•1 comments

OpenAI is developing alternative to Microsoft's GitHub

https://www.reuters.com/business/openai-is-developing-alternative-microsofts-github-information-r...
3•0in•35m ago•0 comments

Scaling up enhanced rock weathering for equitable climate change mitigation

https://www.nature.com/articles/s44458-026-00034-w
1•PaulHoule•35m ago•0 comments

Sam Altman says OpenAI is renegotiating Pentagon 'opportunistic and sloppy' deal

https://fortune.com/2026/03/03/sam-altman-openai-pentagon-renegotiating-deal-anthropic/
1•jacquesm•36m ago•0 comments

Show HN: I built a LLM human rights evaluator for HN (content vs. site behavior)

https://observatory.unratified.org
2•9wzYQbTYsAIc•37m ago•2 comments

The Supreme Court doesn't care if you want to copyright your AI-generated art

https://www.engadget.com/ai/the-supreme-court-doesnt-care-if-you-want-to-copyright-your-ai-genera...
3•latexr•38m ago•0 comments

Google Chrome switches to two-week release cycle

https://developer.chrome.com/blog/chrome-two-week-release
1•mkurz•40m ago•0 comments

ChatGPT Health 'under-triaged' half of medical emergencies in a new study

https://www.nbcnews.com/health/health-news/chatgpt-health-under-triaged-half-medical-emergencies-...
1•0in•42m ago•0 comments

Universal-3 Pro Streaming

https://www.assemblyai.com/universal-3-pro-streaming
1•handfuloflight•45m ago•0 comments

Show HN: Dracula-AI – A lightweight, async SQLite-backed Gemini wrapper

https://github.com/suleymanibis0/dracula
1•suleymanibis•47m ago•0 comments