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?

Seodata.dev – free search volume data to see search demand for your projects

https://www.seodata.dev/
1•alentodorov•2m ago•0 comments

Executive Order pushes fixed-price contracting but implementation questions loom

https://www.washingtontechnology.com/contracts/2026/05/trump-executive-order-pushes-fixed-price-c...
1•WaitWaitWha•3m ago•0 comments

Neanderthals ran 'fat factories' 125,000 years ago

https://www.universiteitleiden.nl/en/news/2025/07/neanderthals-ran-fat-factories-125000-years-ago
1•andsoitis•3m ago•0 comments

Great Writers "Tell" All the Time

https://freddiedeboer.substack.com/p/great-writers-tell-all-the-time
1•paulpauper•5m ago•0 comments

House Bill Cuts Federal Funds for Online Censorship

https://reclaimthenet.org/house-bill-cuts-federal-funds-for-online-censorship
2•anonymousiam•6m ago•0 comments

When People Say They Want to Send Their Kid to a Good School

https://freddiedeboer.substack.com/p/when-people-say-they-want-good-schools
1•paulpauper•7m ago•0 comments

If Nobody Builds It, Everybody Dies [pdf]

https://github.com/INBED/pub/releases/download/v1.1/I.N.B.E.D.pdf
2•Anon84•10m ago•1 comments

Why won't SQLite give back my disk space?

https://www.valiantlynx.com/blogs/why-wont-sqlite-give-back-my-disk-space
1•madshalden•14m ago•0 comments

Show HN: Clipmon is a macOS clipboard manager on steroids

https://github.com/c9-labs/clipmon
2•vednig•17m ago•0 comments

Narrow by Design: The Case for Composable AI Teams

https://substack.com/@ashconway/note/p-196059865
1•ashconway•17m ago•1 comments

Show HN: I built a dev workspace with AI as backbone

https://thekit.dev/
2•RaiyanYahya•25m ago•0 comments

Deepfakes Are Coming for Your Bank Account

https://www.theatlantic.com/technology/2026/05/chatgpt-images-deepfakes-fraud/687023/
3•saikatsg•26m ago•0 comments

Automating Hermitage to see how transactions differ in MySQL and MariaDB

https://theconsensus.dev/p/2026/05/02/automating-hermitage.html
1•zdw•29m ago•0 comments

We (US Navy) are like pirates... it's a profitable business

https://www.theguardian.com/world/2026/may/02/trump-us-navy-pirates-iran-blockade
3•hedayet•29m ago•0 comments

Pentagon to pull 5k troops from Germany, alarming Republican lawmakers

https://www.washingtonpost.com/national-security/2026/05/01/us-troops-germany-trump-merz/
2•alefalfa•31m ago•2 comments

Preliminary Findings on AI Automation from Worker Evaluations

https://arxiv.org/abs/2604.01363
4•saikatsg•31m ago•0 comments

How the JVM Optimizes Generic Code – A Deep Dive

https://inside.java/2026/04/19/generics-optimization/
3•matt_d•32m ago•0 comments

The Elizabeth line is getting video wrap-around advertising screens

https://www.ianvisits.co.uk/articles/the-elizabeth-line-is-getting-massive-video-wrap-around-adve...
4•zeristor•32m ago•2 comments

Re: Slow USB storage device? (util-Linux-ng, 2010)

https://marc.info/?l=util-linux-ng&m=126351534518733&w=2
1•juliusdavies•32m ago•0 comments

Do octopus brains work like humans'–or is there another way to be smart?

https://www.nature.com/articles/d41586-026-01302-4
3•beardyw•33m ago•0 comments

Show HN: Virshle – Make ordinary virtual machines

https://virshle.crocuda.com/
2•jean_dupont•41m ago•0 comments

Why North Korea Will Never Give Up Its Nuclear Weapons

https://spectator.clingendael.org/en/publication/why-north-korea-will-never-give-its-nuclear-weapons
2•ck45•42m ago•2 comments

The Advance of Heliotherapy – Nature

https://www.nature.com/articles/109663a0?twclid=24ras4wi5qjw2lcvz2mgnnna5z
4•bilsbie•42m ago•0 comments

Emergent swarm bio structure – mark 36

https://rogmash.neocities.org/
1•rogmash•43m ago•1 comments

I Do Not Recommend Bitwarden

https://xn--gckvb8fzb.com/i-do-not-recommend-bitwarden/
32•maxloh•43m ago•20 comments

English councils to trial Google AI tool to speed up planning decisions

https://www.ft.com/content/91ce4475-d325-4d65-babb-4214996bc0f6
2•mmarian•48m ago•1 comments

VS Code inserting 'Co-Authored-by Copilot' into commits regardless of usage

https://github.com/microsoft/vscode/pull/310226
4•indrora•48m ago•0 comments

Museum Speelklok

https://www.museumspeelklok.nl/en/
2•whtspc64•54m ago•0 comments

Pixel Embeddings Beat Vision Encoders for Unified Understanding and Generation

https://github.com/facebookresearch/tuna-2
2•neehao•55m ago•0 comments

Azthengar Build 2026.05.01

https://azthengar.itch.io/azthengar-build-20260501
1•RobotHouse•56m ago•0 comments