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?

Is SVG the Final Frontier?

https://svg.new/blog/is-svg-the-final-frontier
2•swazzy•1m ago•0 comments

120k USD conpute credits from various providers

1•chrisvee•2m ago•1 comments

A Deep Dive into Tinygrad AI Compiler

https://tinyblog-phi.vercel.app/tinygrad
1•ppadjin123•12m ago•0 comments

Strait of Hormuz Gameplay Demo [video]

https://www.youtube.com/watch?v=XVY7WAT4OdE
1•us321•13m ago•0 comments

Lawsuit over who owns top ranked coding bootcamp Codesmith

https://michaelnovati.substack.com/p/codesmith-in-court-the-hard-parts
1•michaelnovati•17m ago•0 comments

Apple Stops Accepting Orders for Some Mac Mini and Mac Studio Models

https://www.macrumors.com/2026/04/11/some-mac-mini-mac-studio-currently-unavailable/
1•Brajeshwar•20m ago•0 comments

Salesforce and ServiceNow are squaring off in the battle for the helpdesk

https://www.theregister.com/2026/04/11/salesforce_vs_servicenow_itsm_battle/
2•Brajeshwar•20m ago•1 comments

Show HN: Bullseye2D – A Dart library for cross-platform 2D games

https://github.com/bullseye2d/bullseye2d
2•joemanaco•21m ago•0 comments

Apple update looks like Czech mate for locked-out iPhone user

https://www.theregister.com/2026/04/12/ios_passcode_bug/
8•OuterVale•22m ago•0 comments

Phyphox – Physical Experiments Using a Smartphone

https://phyphox.org/
2•_Microft•22m ago•1 comments

Asha Bhosle: The sound of Bollywood dies aged 92

https://www.bbc.com/news/articles/c6ppd0qdp1do
1•Brajeshwar•26m ago•1 comments

Joborigo – Job application tracker with ghost detection and employer API

https://www.joborigo.com/
1•sasanin•27m ago•1 comments

On Division by Three

https://leahneukirchen.org/blog/archive/2023/11.html
1•jruohonen•27m ago•0 comments

Show HN: Food Decoder

https://github.com/adityaprasad-sudo/FoodDecoder
1•PotatoAditya•29m ago•1 comments

Angular Compiler in Rust – Experimental and 10x faster

https://voidzero.dev/posts/oxc-angular-compiler
1•AbuAssar•31m ago•0 comments

Podman Kube Generator – Web UI to Generate Kubernetes YAML and Quadlet Configs

https://github.com/Garfieldttt/podman-kube-generator
2•Garfieldttt•34m ago•0 comments

System Integrity Protection: The misunderstood (macos) setting

https://khronokernel.com/macos/2022/12/09/SIP.html
1•gurjeet•34m ago•0 comments

Can AI Think?

https://medium.com/@henry.ponco/can-ai-ever-truly-think-92d62e509862
1•ponco•35m ago•2 comments

Is Math Big or Small?

https://chessapig.github.io/talks/Big-Small
1•robinhouston•35m ago•0 comments

Show HN: Attempting to Design a Minimalistic Website

https://soham-saha.github.io/
1•omegacombinator•36m ago•0 comments

Sorting with Singeli

https://github.com/mlochbaum/SingeliSort
1•tosh•38m ago•0 comments

How to Read Headphone Measurements (2020)

https://crinacle.com/2020/04/08/graphs-101-how-to-read-headphone-measurements/
1•tosh•39m ago•0 comments

Ask HN: How do you retain what you learn from podcasts?

2•LifeOfKP•43m ago•2 comments

A/B/U Review System

https://openresearchinstitute.org/onboarding/A_B_U.html
1•patcon•44m ago•0 comments

ORAC-NT – A 3D Tactical Bridge for NASA Kepler/Tess Star Stability

https://orac-nt.streamlit.app/
2•DREDREG•44m ago•1 comments

How the "AI Loser" may end up winning

https://adlrocha.substack.com/p/adlrocha-how-the-ai-loser-may-end
1•adlrocha•46m ago•0 comments

The big math changes to small math by same change and solve in Matlab BVP4C

https://www.nature.com/articles/s41598-025-18302-5
1•internet_points•49m ago•0 comments

Build nice terminal UI with Bubble Tea

https://www.prskavec.net/post/bubbletea/
2•swq115•51m ago•0 comments

Ask HN: How is everyone dealing with the increase of code reviews?

2•Lethalman•55m ago•0 comments

The API Key Is Dead: A Blueprint for Agent Identity in the Age of MCP

https://kontext.security/content/oauth-for-mcp-agents
1•mc-serious•55m ago•0 comments