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

SpaceX: For Mars or Wars?

https://i.postimg.cc/mR4RyVdx/UXTx-D2t.jpg
1•transmartian•27s ago•0 comments

How to Build Reddit Karma Fast

https://karmabuilder.xyz/blog/how-to-build-reddit-karma-fast
1•m00dy•8m ago•0 comments

Who's Gonna Carry the Boats?

https://apps.apple.com/us/app/quit-all-break-every-habit/id6760978934
1•apoorvdarshan•8m ago•1 comments

App Defaults in March 2026

https://brainbaking.com/post/2026/03/app-defaults-march-2026/
1•Brajeshwar•14m ago•0 comments

Gorgeous DIY camera looks straight out of Severance

https://www.dpreview.com/articles/9055612016/saturnix-diy-camera-alien-sci-fi-raspberry-pi
1•swq115•16m ago•0 comments

MXFP8 GEMM: Up to 99% of cuBLAS Performance Using CUDA and PTX

https://danielvegamyhre.github.io/2026/03/29/mxfp8-gemm.html
1•matt_d•21m ago•0 comments

We Need Servers – Lots of Servers

https://www.nextplatform.com/compute/2026/03/26/we-need-servers-lots-of-servers/5211678
1•jonbaer•23m ago•0 comments

Everyone Hates iPhone Autocorrect. An Update Fixes One of the Biggest Problems

https://www.wsj.com/tech/apple-iphone-autocorrect-update-7659d618
2•RyanShook•25m ago•2 comments

Searching for the Perfect Sync

https://sunshine-jones.com/searching-for-the-perfect-sync/
1•lightyrs•28m ago•1 comments

Volvo Infotainment Glitches Spark Class Action Lawsuit

https://www.autoblog.com/news/volvo-infotainment-glitches-spark-major-class-action-lawsuit
1•carefree-bob•33m ago•1 comments

Epic Lays Off Employee with Terminal Brain Cancer Who Cant Get LifeInsurance Now

https://kotaku.com/epic-games-layoffs-fortnite-brain-cancer-2000682941
1•Jimmc414•33m ago•1 comments

Show HN: React-Rewrite – Figma for localhost that directly edits your codebase

https://github.com/donghaxkim/react-rewrite
1•donghaxkim•36m ago•0 comments

The Socially Acceptable Use of AI in Business

https://kellblog.com/2026/03/29/on-the-socially-acceptable-use-of-ai-in-business/
1•doppp•39m ago•0 comments

AI-powered migrations from Postgres to ClickHouse

https://clickhouse.com/blog/ai-powered-migraiton-from-postgres-to-clickhouse-with-fiveonefour
2•tosh•39m ago•0 comments

SparkID: Fast, sortable, compact unique IDs

https://www.youssefm.com/posts/sparkid
1•pinkbeanz•41m ago•0 comments

GPT 5.4 sucks at front end

1•apoorvdarshan•43m ago•0 comments

Portable MicroNeedle Fractional RF Machine

https://www.sanhelasers.com/products/portable-fractional-microneedle-rf-machine/
1•SANHE•51m ago•0 comments

The Sudden Fall of OpenAI's Most Hyped Product Since ChatGPT

https://www.wsj.com/tech/ai/the-sudden-fall-of-openais-most-hyped-product-since-chatgpt-64c730c9
11•fortran77•52m ago•9 comments

Pretext

https://simonwillison.net/2026/Mar/29/pretext/
3•lumpa•52m ago•0 comments

How to Recognise Kentucky on a Map

https://mammothmemory.net/geography/usa/states-of-america/how-to-remember-where-the-american-stat...
2•kamaraju•53m ago•0 comments

Training the Idea Muscle

https://sfalexandria.com/posts/rileys-ideas/
3•nanfinitum•57m ago•0 comments

PyTorch Autograd and Mutation

https://blog.ezyang.com/2026/03/autograd-and-mutation/
2•matt_d•1h ago•0 comments

Why Don't You Use String Views Instead of Passing Std:Wstring by Const&

https://giodicanio.com/2024/05/14/why-dont-you-use-string-views-like-std-wstring_view-instead-of-...
2•Orochikaku•1h ago•0 comments

Agentic Hive – Manage Claude Code and Codex Tmux Sessions from a Browser

https://github.com/wisbric/agentic-hive
2•sscharlott•1h ago•0 comments

RAM Bubble Popping?

https://twitter.com/aakashgupta/status/2038077441911275594
1•roganp•1h ago•0 comments

How We Rewrote 130K Lines from React to Svelte in Two Weeks

https://strawberrybrowser.com/blog/react-to-svelte
3•thunderbong•1h ago•0 comments

Show HN: Real-time visualization of Claude Code agent orchestration

https://github.com/patoles/agent-flow
2•daco•1h ago•0 comments

Will This 'Miracle' Battery Change Your Mind About EVs?

https://www.wsj.com/lifestyle/cars/donut-lab-solid-state-battery-ssb-ev-4e6ad966
2•helterskelter•1h ago•2 comments

Seeing Trump Clearly

https://www.craigmurray.org.uk/archives/2026/03/seeing-trump-clearly/
2•curmudgeon22•1h ago•2 comments

We audited our own AI-written codebase. 13 issues, 5 categories

https://koalr.com/blog/ai-codebase-audit
1•Andrew_McCarron•1h ago•0 comments