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

New Bitcoin Fee Pressure Signal

https://chainquery.com/reports/fee-pressure
1•granya•1m ago•0 comments

Global Biolab Map

https://global-biolab-atlas.netlify.app/
1•sebg•1m ago•0 comments

Staged Publishing for NPM Packages

https://docs.npmjs.com/staged-publishing/
1•jonchurch_•3m ago•0 comments

Moe inference optimizations: 15% lower expert load by request reordering

https://blog.doubleword.ai/moe-expert-coactivations
1•mezark•5m ago•0 comments

Show HN: A fast, free AI rewriter

https://revise.io/ai-rewriter
1•artursapek•8m ago•0 comments

Model Thinking – Percolation Models (2020) [video]

https://www.youtube.com/watch?v=Bs0QuGYrPAI
1•throwaw12•9m ago•0 comments

Shareable text box

https://txt.box
2•shikhar•9m ago•0 comments

Boundaries – A Talk by Gary Bernhardt

https://www.destroyallsoftware.com/talks/boundaries
1•throwaw12•9m ago•0 comments

DOS Zone

https://dos.zone/
4•rglover•17m ago•0 comments

Everything Is Computer: On Palantir's Manifesto and the Recompiling of the State

https://turbulence.substack.com/p/everything-is-computer
2•ivm•18m ago•0 comments

Step by step guide: How to install Microsoft Office in any Linux distribution

https://gist.github.com/eylenburg/38e5da371b7fedc0662198efc66be57b
1•nogajun•19m ago•0 comments

China Wants A.I. To Flourish, but Not at the Expense of Jobs

https://www.nytimes.com/2026/05/19/business/china-ai-unemployment.html
2•tom2026hn•20m ago•1 comments

Node.js TypeScript: The future of –experimental-transform-types

https://github.com/nodejs/typescript/issues/51
2•lioeters•24m ago•0 comments

Can one run AI on source code with the prompt "Find below-avg swear rate files"?

1•pcwir•25m ago•0 comments

TheLounge v4.5.0 released – a modern, self-hosted web IRC client

https://github.com/thelounge/thelounge/releases/tag/v4.5.0
1•MaxLeiter•29m ago•0 comments

Franklin Pierce by David W. Blight

https://inpursuit.substack.com/p/franklin-pierce-by-david-w-blight
1•samclemens•30m ago•0 comments

Alan's ASI Checklist

https://lifearchitect.ai/asi/
1•k2xl•30m ago•0 comments

Why Many Americans Choose Not to Have Children

https://www.nytimes.com/2026/05/12/opinion/letters/birthrates-no-children.html
2•paulpauper•30m ago•0 comments

Font licensing is about to change

https://www.mixfont.com/blog/font-licensing-is-about-to-change
3•justswim•31m ago•0 comments

The AI economy is rewriting the American Dream

https://www.cnbc.com/2026/05/19/ai-hiring-slowdown-skilled-trade-workers.html
3•paulpauper•31m ago•0 comments

Productivity Growth in the U.S. Medical Care Sector [pdf]

https://www.bea.gov/sites/default/files/papers/BEA-WP2026-11.pdf
1•paulpauper•32m ago•0 comments

Starbucks cold plastic cups don't make it to recycling, probe finds

https://www.washingtonpost.com/climate-environment/2026/05/20/starbucks-cold-plastic-cups-dont-ma...
2•reaperducer•32m ago•0 comments

Google accused of pushing 'free for life' G Suite users onto paid plans

https://www.theregister.com/applications/2026/05/19/google-accused-of-pushing-free-for-life-g-sui...
2•nonfamous•33m ago•0 comments

If you can't get a job today, it's your fault

https://auren.substack.com/p/if-you-cant-get-a-job-today-its-your
5•jger15•36m ago•0 comments

Open Weight Music Generation Models Trained on Licensed Data

https://stability.ai/news-updates/meet-stable-audio-3-the-model-family-built-for-artistic-experim...
1•SweetSoftPillow•37m ago•0 comments

Jewish American Security Act requires online platforms to moderate purge content

https://www.lankford.senate.gov/news/press-releases/lankford-rosen-introduce-comprehensive-bipart...
5•qwertyuiop_•38m ago•1 comments

Open AI solves a 1946 Erdős problem

https://twitter.com/openai/status/2057176201782075690
2•bcapchickadee•39m ago•0 comments

The Developer's Guide to AI

https://nostarch.com/developers-guide-to-ai
1•teleforce•41m ago•0 comments

Medieval China's Lost Ocean Empire

https://lostfutures.substack.com/p/chinas-forgotten-maritime-empire
2•Lost-Futures•43m ago•0 comments

Even Claude agrees: hole in its sandbox was real and dangerous

https://www.theregister.com/security/2026/05/20/even-claude-agrees-hole-in-its-sandbox-was-real-a...
2•sbulaev•44m ago•0 comments