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

Explosive Skill Acquisition

https://bengoldhaber.substack.com/p/explosive-skill-acquisition
1•lindowe•2m ago•0 comments

My Seeker Phone

https://avc.xyz/my-seeker-phone
1•wslh•4m ago•0 comments

Stopping bad guys from using my open source project (feedback wanted)

https://evanhahn.com/stopping-bad-guys-from-using-my-open-source-project/
2•emschwartz•6m ago•1 comments

Easily duped by his Stanford veneer with O realizing he's a CCP mouthpiece

https://twitter.com/Byron_Wan/status/1993489995156647971
1•737min•9m ago•0 comments

The Beguiling, Misunderstood Theremin

https://www.nytimes.com/2025/11/29/arts/music/theremin-instrument.html
1•Kaibeezy•10m ago•1 comments

EU to Target Apple Maps and Apple Ads Next

https://www.macrumors.com/2025/11/28/eu-targets-apple-maps-and-apple-ads/
1•Sir_Twist•12m ago•0 comments

Couple allegedly used hidden camera, earpieces to win $1.18M from Crown casino

https://www.theguardian.com/australia-news/2025/nov/30/couple-from-kazakhstan-allegedly-used-hidd...
2•defrost•12m ago•0 comments

Meshtastic

https://meshtastic.org/
1•debo_•15m ago•1 comments

YouTube Recommendation Algo

1•solarized•16m ago•0 comments

A new Little Prince museum has opened its doors in Switzerland

https://www.lepetitprince.com/en/events-around-the-world/a-new-little-prince-museum-has-opened-it...
2•gnabgib•28m ago•0 comments

Software Is Not the Service

https://green.spacedino.net/software-is-not-the-service/
1•surprisetalk•32m ago•0 comments

What's the Deal with Euler's Identity?

https://lcamtuf.substack.com/p/whats-the-deal-with-eulers-identity
1•surprisetalk•32m ago•0 comments

ASML Got EUV Lithography

https://www.factorysettings.org/p/how-asml-got-euv-lithography
1•surprisetalk•32m ago•0 comments

Sega Master System: Fancier Tile Graphics

https://bumbershootsoft.wordpress.com/2025/11/29/sega-master-system-fancier-tile-graphics/
1•ibobev•32m ago•0 comments

A Circle in the Hyperbolic Plane

https://www.johndcook.com/blog/2025/11/28/hyperbolic-circle/
1•ibobev•33m ago•0 comments

Monero Subaddresses

https://www.johndcook.com/blog/2025/11/28/monero-subaddresses/
1•ibobev•33m ago•0 comments

Inflation-hit Americans receive free $12,000 in crypto

https://www.thestreet.com/crypto/markets/inflation-hit-americans-receive-free-12000-in-crypto
1•harambae•35m ago•0 comments

A Bus Ride and the (At Least) 3x UX FAILs

https://bsdly.blogspot.com/2025/11/a-bus-ride-and-at-least-3x-ux-fails.html
2•zdw•42m ago•0 comments

Is memory-safe Linux within reach?

https://agarriga.substack.com/p/is-memory-safe-linux-within-reach
2•rhaps0dy•44m ago•2 comments

Think twice before translating all C to Rust

https://agarriga.substack.com/p/think-twice-before-translating-all
2•rhaps0dy•46m ago•0 comments

Gaza death toll surpasses 70k, says health ministry

https://www.theguardian.com/world/2025/nov/29/gaza-death-toll-rises-says-health-ministry
4•NomDePlum•48m ago•1 comments

PgFirstAid-The PostgreSQL Health Check Blog Post

https://randoneering.tech/blog/pgfirstaid/pgfirstaid/
1•todsacerdoti•50m ago•0 comments

Why Now? Why Me?: On Stumbling into a Solution That Shouldn't Have Been Mine

https://twitter.com/aialchemistart/status/1994925263822754147
1•LooseThreadsInt•50m ago•0 comments

Show HN: DotVeil – open-source, zero-knowledge .env sync for developers

https://github.com/klayserDev/dotveil
1•klayser•50m ago•1 comments

Simpler Java Build Tools with Object Oriented Programming [video]

https://www.youtube.com/watch?v=S47RpH_4Zn4
1•lihaoyi•53m ago•0 comments

Google Antigravity just deleted the contents of my whole drive

https://old.reddit.com/r/google_antigravity/comments/1p82or6/google_antigravity_just_deleted_the_...
3•iLoveOncall•53m ago•0 comments

ReScript 12

https://rescript-lang.org/blog/release-12-0-0/
2•sprkv5•55m ago•1 comments

The axis: the left-right spectrum has a non-ideology problem

https://www.gelliottmorris.com/p/not-just-left-vs-right-most-voters
1•aworks•57m ago•1 comments

Happiness Isn't Exponential

https://timemgmt.substack.com/p/happiness-isnt-exponential-22-08-23
2•tylerdane•1h ago•0 comments

Bazaar: New App Store for Gnome

https://github.com/kolunmi/bazaar
1•doener•1h ago•0 comments