frontpage.
newsnewestaskshowjobs

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?

Is Musk the richest American ever now? No, except as a consumer

1•dfps•48s ago•0 comments

CoreAI_HTCE

https://github.com/miroaleksej/CoreAI_HTCE
1•CoreAi_HTCE•2m ago•0 comments

From AGI to ASI

https://arxiv.org/abs/2606.12683
1•artninja1988•6m ago•0 comments

Pilot and 11 skydiving passengers killed in Missouri plane crash

https://www.theguardian.com/us-news/2026/jun/14/butler-missouri-plane-crash
2•sva_•10m ago•0 comments

How to Build a Phyle

https://lasindias.net/indianopedia/How_to_build_a_phyle
1•rwl•12m ago•0 comments

What does high effort mean when AI has made everything low effort?

2•foxtrot8672•12m ago•2 comments

I built a free tool that tells you if an LLM will run on your GPU

https://www.slopesome.com
1•NexAIGuy•13m ago•0 comments

Leave It to Beaver: Everything is bigger at Buc-ee's

https://thebaffler.com/outbursts/leave-it-to-beaver-wilder
1•NaOH•17m ago•0 comments

Virology Research Is Not a Crime

https://rasmussenretorts.substack.com/p/virology-research-is-not-a-crime
3•hn_acker•21m ago•1 comments

Abandoned and Little-Known Airfields

https://airfields-freeman.com/
2•wizardforhire•21m ago•0 comments

2026 Global Peace Index [pdf]

https://www.visionofhumanity.org/wp-content/uploads/2026/06/Global-Peace-Index-2026-Report.pdf
3•simonebrunozzi•22m ago•0 comments

KPMG report on AI found riddled with AI hallucinations

https://www.cityam.com/kpmg-report-on-ai-found-riddled-with-ai-hallucinations/
3•chrisjj•23m ago•1 comments

Compute 'S Atari ST Reference Books – By Paul Lefebvre

https://www.goto10retro.com/p/computes-atari-st-reference-books
1•rbanffy•23m ago•0 comments

Ask HN: I am a junior CS and math major. I have no hope for SWE or math. Advice?

1•jidhn•25m ago•2 comments

Seer – an Ollama workspace where two models build and review code

https://manticthink.com/c/a57jfwt
1•SEERai•28m ago•0 comments

Show HN: I hate typing continue once my CC quota resets

https://github.com/softcane/cc-session-recover
1•pradeep1177•28m ago•0 comments

Frona v2026.6.0 – self-hosted personal AI assistant

https://github.com/fronalabs/frona/releases/tag/v2026.6.0
1•syncerx•28m ago•0 comments

Itty Bitty Mosquito Committee

https://www.ittybittymosquitocommittee.org
1•mlinksva•29m ago•0 comments

Chaosnet

https://tumbleweed.nu/r/lm-3/uv/amber.html
9•RGBCube•32m ago•0 comments

Road trip – Drop Junk Cars – Cows aren't hurt

https://screen.toys/roadtrip/
1•gurjeet•33m ago•0 comments

Einstein's Mirror

https://sketchplanations.com/einsteins-mirror
1•nate•33m ago•0 comments

Yserver: A modern X11 server written in Rust

https://github.com/joske/yserver
4•Venn1•36m ago•0 comments

Mathematical and Algorithmic Specification of an Advanced Cognitive Architecture

https://zenodo.org/records/20684784
1•hiddenarchitect•36m ago•0 comments

Ask HN: Which Free Software or Open Source Project Needs Help?

3•em-bee•38m ago•1 comments

Why isn't the external link symbol in Unicode? (2018)

https://dafoster.net/articles/2018/11/24/why-isnt-the-external-link-symbol-in-unicode/
1•downbad_•38m ago•1 comments

One Moving Part: The Forest Service Ax Manual

https://www.fs.usda.gov/inside-fs/delivering-mission/deliver/one-moving-part-forest-service-ax-ma...
1•helterskelter•38m ago•0 comments

Android's head of security slams Google's door

https://www.lesnumeriques.com/societe-numerique/la-direction-a-perdu-toute-boussole-morale-le-che...
1•trilogic•39m ago•0 comments

Losing on Purpose: The Economics of NBA Tanking

https://myteamtanks.com/
2•jonbaer•40m ago•0 comments

The Telematico NMS3000 – Celso Martinho

https://celso.io/posts/2026/06/13/telematico/
2•rbanffy•40m ago•0 comments

Karpathy on Why 'Edutainment' Isn't Real Learning (Seek the Sweat) (2024)

https://twitter.com/karpathy/status/1756380066580455557
2•laxmena•42m ago•1 comments