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?

OpenCRA

https://github.com/borisRadonic/OpenCRA
2•BorisRadonic•1m ago•1 comments

The Gap Map v0.1

https://www.currentai.org/blogs/introducing-the-gap-map-v0-1
1•surprisetalk•3m ago•0 comments

Show HN: Sprytools – 26 small developer APIs behind one key

https://sprytools.com/api/
1•grenzfrei•3m ago•0 comments

Netherlands recruited 29 top scientist leaving U.S. under Trump

https://nltimes.nl/2026/07/07/netherlands-recruited-29-top-scientist-leaving-us-trump
1•jacquesm•3m ago•1 comments

Hacking the bureaucracy to get stuff done (2020)

https://www.zainrizvi.io/blog/hacking-the-bureaucracy-to-get-stuff-done/
1•cdirkx•3m ago•0 comments

A visual calculator to estimate and compare LLM API pricing

https://neutraloverdrive.com/tools/token-calculator/
1•brancpa•4m ago•0 comments

Software is eating the world, AUTONOMOUSLY

https://2030.marketing/software-is-eating-the-world-autonomously/
1•TechOnionKing•4m ago•0 comments

Space Force's high-powered electro beam nullifies hostile satellites

https://newatlas.com/military/space-force-meadowlands-satellite-blinding-beam-weapon/
1•geox•5m ago•0 comments

Show HN: SigMap – deterministic repo maps for AI coding agents

https://sigmap.io
2•cees007•5m ago•0 comments

Ask HN: What are alternative to Upwork for side gig?

2•user7878•6m ago•1 comments

Show HN: Sdlc factory built on pi.dev:intent->DDD->architecture->tested code

https://github.com/arman-jalili/guardian-framework
1•arman-w-jalili•6m ago•0 comments

Court allows far-right leader Marine Le Pen to run for president

https://www.nbcnews.com/world/europe/france-far-right-marine-le-pen-presidential-election-macron-...
1•Alien1Being•6m ago•0 comments

A design system for Rust/egui where token violations fail the build

https://ouroboros-ui.typezerolabs.com
1•mauriciojuba•7m ago•0 comments

The Perfect Cripple: A User Guide to Being Palatable

https://www.salient.org.nz/post/the-perfect-cripple-a-user-guide-to-being-palatable
1•speckx•8m ago•0 comments

Discovery helps explain why solid-state batteries often fail

https://news.mit.edu/2026/discovery-helps-explain-why-solid-state-batteries-often-fail-0706
1•gmays•9m ago•0 comments

Amazon Returns to US Bond Market to Fund AI Infrastructure Build

https://www.bloomberg.com/news/articles/2026-07-07/amazon-returns-to-us-bond-market-to-fund-ai-in...
2•thm•10m ago•0 comments

The Popup That Says the Quiet Part Out Loud

https://blog.ppb1701.com/the-popup-that-says-the-quiet-part-out-loud
1•ExMachina73•10m ago•0 comments

I was wrong about Duff's device

https://unsung.aresluna.org/i-was-wrong-about-duffs-device/
1•colejohnson66•10m ago•0 comments

Agents don't need smarter models, they need a map

https://horiacristescu.github.io/karto-plugin/
1•visarga•12m ago•0 comments

Dua Lipa opens library for banned and censored books in Portugal

https://www.euronews.com/culture/2026/06/29/dua-lipa-opens-library-for-banned-and-censored-books-...
5•pax•12m ago•0 comments

Gladia-CLI: A command-line tool for audio transcription

https://github.com/gladiaio/gladia-cli
3•mgaudin•14m ago•0 comments

Effects as Capabilities

https://nrinaudo.github.io/talks/capabilities.html
1•marvinborner•14m ago•0 comments

Yamanote.fun – A complete soundscape for Tokyo's Yamanote line

https://www.yamanote.fun/
1•madebymagnolia•15m ago•0 comments

98% Isn't Much

https://whynothugo.nl/journal/2026/07/03/98-isnt-very-much/
38•speckx•17m ago•10 comments

A better way to tie your gym shorts. (Or any drawstring) [video]

https://www.youtube.com/watch?v=3R0Lp86GEBk
2•surprisetalk•18m ago•0 comments

Entering the Agentocene: A Statistical Investigation of AI-Era Coding

https://jauu.net/posts/2026-07-05-entering-the-agentocene/
1•hgn•18m ago•0 comments

Why is integration so much harder than differentiation? (2020)

https://math.stackexchange.com/questions/20578/why-is-integration-so-much-harder-than-differentia...
2•vismit2000•19m ago•0 comments

Best iOS Weight Lifting App for iPhone and Apple Watch (2026)

https://musklr.com/blog/2026/best-ios-weight-lifting-app-apple-watch/
1•badgag•19m ago•0 comments

Turn commodity WiFi signals into real-time spatial intelligence

https://github.com/ruvnet/RuView
2•adithyaharish•20m ago•1 comments

Show HN: What if your personal website was ChatGPT?

https://antonlorani.de/en-us/conversation
1•mrbnprck•20m ago•2 comments