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

Iron Beam: Israel's first operational anti drone laser system

https://mod.gov.il/en/press-releases/press-room/israel-mod-and-rafael-deliver-first-operational-h...
1•fork-bomber•35s ago•0 comments

Show HN: I built a Chrome Extension that turns any web data into charts/KPIs

https://chromewebstore.google.com/detail/datastripes-lens/hppbpldjppcpdfienngbiippkboajamb
1•vinserello•51s ago•0 comments

Machine Learning in Clojure with Libpython‑Clj: Unlocking Causal Insights

https://medium.com/@flexianadevgroup/machine-learning-in-clojure-with-libpython-clj-unlocking-cau...
1•simonpure•2m ago•0 comments

Show HN: vmux – Run Python in Cloudflare containers in 3s

https://vmux.sdan.io/
1•sdan•2m ago•0 comments

Linux Is Not Stable

https://crowfunder.github.io/posts/linux-is-not-stable/
1•crowfunder•4m ago•1 comments

How Easy It Is to Steal Your Data with a Chrome Extension

https://notnotp.com/notes/steal-your-data-with-a-chrome-extension/
1•enz•7m ago•0 comments

Claude Is Growing Tomatoes

https://autoncorp.com/biodome/
1•bpavuk•8m ago•0 comments

New Year's Fireworks Simulator in Your Terminal

https://github.com/willmcgugan/ny2026
1•willm•8m ago•0 comments

Show HN: I made islechat, like Slack but in the terminal over SSH

1•ashfn•9m ago•2 comments

Copenhagen Street Tree Density

https://cphtrees.netlify.app/
1•pppone•10m ago•0 comments

Show HN: Repair-JSON-stream – Fix broken JSON from LLM streaming (1.7x faster)

https://github.com/prxtenses/repair-json-stream
1•prxtenses•10m ago•0 comments

When Your Endpoints Play Russian Roulette and You're Holding the Gun

https://synapsflow.com/article/api-roulette-when-your-endpoints-play-russian-roulette-and-you-re-...
1•SynapsFlow•11m ago•1 comments

Curses, Vengeance, and Fishtails: The Cornish Mermaid in Perspective [pdf]

https://www.academia.edu/31865439/Curses_Vengeance_and_Fishtails_The_Cornish_Mermaid_in_Perspective
1•thunderbong•12m ago•0 comments

Customize Your Windows Within Sophia Script for Windows

https://github.com/farag2/Sophia-Script-for-Windows
1•farag2•14m ago•0 comments

The Story of OnlineOTP

https://jameelur.com/blog/online-otp-going-offline
1•WanderingSoul•16m ago•0 comments

When the line stops going up

https://www.coryzue.com/writing/the-line/
2•pdyc•16m ago•0 comments

Fixing My System76 Laptop in 20 Minutes or Less

https://danielmangum.com/posts/fix-system76-laptop-20-min/
1•hasheddan•18m ago•0 comments

Cheap solar is transforming lives and economies across Africa

https://www.nytimes.com/2025/12/30/climate/solar-south-africa-china.html
2•botanical•18m ago•1 comments

What Is a Memristor?

https://www.electricalvolt.com/what-is-a-memristor-principle-types-advantages-applications/
1•slicktux•18m ago•0 comments

Efficient method to capture CO2 from the atmosphere / Univ of Helsinki

https://www.helsinki.fi/en/news/innovations/efficient-method-capture-carbon-dioxide-atmosphere-de...
3•lrasinen•20m ago•0 comments

Ask HN: What makes you instantly downvote a post?

2•ClipNoteBook•21m ago•2 comments

How the AI 'bubble' compares to history

https://www.ft.com/content/41e9d03a-e5c1-4862-9836-b3c80b3f9be4
1•1vuio0pswjnm7•22m ago•1 comments

The famous '1984' ad was first shown in 1983

https://appleinsider.com/articles/25/12/31/how-and-why-the-famous-1984-ad-was-really-first-shown-...
1•LordGrey•22m ago•1 comments

AI Automation

1•jltackett•22m ago•0 comments

Why an Electron Doesn't Fall into a Proton but a Positron Pulls It All the Way?

https://pajuhaan.medium.com/why-an-electron-doesnt-fall-into-a-proton-but-a-positron-pulls-it-all...
1•pajuhaan•24m ago•1 comments

Freeing 118 GB of W&B experiment data from a broken binary format

https://far.in.net/free-wandb
1•matomatical•25m ago•0 comments

Benefits of Choosing Abp.io for Enterprise Software

https://www.faciletechnolab.com/blog/benefits-of-choosing-abpio-for-enterprise-software/
1•plakhlani2•27m ago•0 comments

AI Labs Are Solving the Power Problem

https://newsletter.semianalysis.com/p/how-ai-labs-are-solving-the-power
6•Symmetry•29m ago•1 comments

PNGine: Bundle WebGPU shaders into portable PNG files (~15 KB self-contained)

https://hugodaniel.com/posts/introducing-pngine/
1•hugodan•30m ago•0 comments

Conditions in the Intel 8087 floating-point chip's microcode

https://www.righto.com/2025/12/8087-microcode-conditions.html
1•colejohnson66•30m ago•0 comments