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?

'Blips' led Australian backyard astronomers to a world-first planetary discovery

https://www.sbs.com.au/news/article/how-amateur-astronauts-are-reshaping-what-we-know-about-space...
1•defrost•2m ago•0 comments

Families Spent Decades on Louisiana's Bayous. The Power Company Pulled the Plug

https://www.wsj.com/us-news/families-spent-decades-on-louisianas-bayous-the-power-company-pulled-...
2•bookofjoe•3m ago•1 comments

Relics of an ancient sandstorm on Mars point to Earth-like winds

https://www.science.org/content/article/relics-ancient-sandstorm-mars-point-earth-winds
1•gmays•12m ago•0 comments

Yout.com Hopes Supreme Court's Cox Ruling Helps Its Case; RIAA Disagrees

https://torrentfreak.com/yout-com-hopes-supreme-courts-cox-ruling-helps-its-case-riaa-disagrees/
2•Cider9986•14m ago•0 comments

Show HN: I forced Claude to play Tetris in Emacs

https://imgur.com/a/e3nxq5k
2•iLemming•19m ago•0 comments

Elon of Ed-Tech

https://getlearnix.com/
1•noahjohnson1•20m ago•3 comments

Tutorial on Event-based Cameras(2020) [pdf]

https://rpg.ifi.uzh.ch/docs/scaramuzza/Tutorial_on_Event_Cameras_Scaramuzza.pdf
1•o4c•28m ago•0 comments

New Kodak Film – Verita 200D Colour Negative

https://www.kodak.com/en/company/press-release/kodak-verita-200d-color-negative-film/
1•coolandsmartrr•33m ago•2 comments

The War Is Turning Iran into a Major World Power

https://www.nytimes.com/2026/04/06/opinion/iran-war-strait-hormuz.html
2•spopejoy•33m ago•2 comments

Google's Gmail Upgrade Decision: 2B Users Must Act Now

https://www.forbes.com/sites/zakdoffman/2026/04/10/googles-gmail-upgrade-decision-2-billion-users...
5•teleforce•38m ago•3 comments

Give your coding agents the context your repo has

https://aspenkit.dev/
2•mvoutov•42m ago•0 comments

Neural Computers

https://arxiv.org/abs/2604.06425
2•Anon84•43m ago•0 comments

RAG 40x faster using binary quantization (2024)

https://lightning.ai/lightning-ai/templates/rag-40x-faster-using-binary-quantization
3•teleforce•50m ago•0 comments

From error-handling to structured concurrency

https://blog.nelhage.com/post/concurrent-error-handling/
1•vinhnx•52m ago•0 comments

Our response to the Axios developer tool compromise

https://openai.com/index/axios-developer-tool-compromise/
7•surprisetalk•52m ago•0 comments

40x Faster Binary Search

https://www.p99conf.io/session/40x-faster-binary-search/
1•teleforce•54m ago•0 comments

Adding Structured Concurrency to JavaScript

https://github.com/bakkot/structured-concurrency-for-js
1•PaulHoule•54m ago•0 comments

Search demand for "coffee shop near me" across 1k US cities

https://www.sextaris.com/blog/coffee-shop-near-me-1000-us-cities
1•verzhykovskyi•55m ago•0 comments

[STORY] Watching Abandoned Toddlers as the End Approaches

https://www.tumblr.com/bixbythemartian/633183446892691456/writing-prompt-s-youre-a-daycare-worker
2•barry-cotter•56m ago•0 comments

Request Camel Numbering

https://gov.om/w/request-camel-numbering
3•earksiinni•1h ago•0 comments

Git per sviluppatori: guida completa dai comandi base al workflow professionale

https://donatodelpeschio.it/blog/git-guida-completa-comandi-workflow
1•donnyBlanko•1h ago•0 comments

A bet on whether ML-KEM-768 or X25519 will break first

https://github.com/FiloSottile/ecc-vs-lattices-long-bet
1•figsoda•1h ago•1 comments

From Spec-Driven Work to Work Orchestration

https://trilogyai.substack.com/p/from-spec-driven-work-to-work-orchestration
2•kumanday•1h ago•0 comments

Hormuz, an MCP-first forecasting engine for reproducible modeling

https://github.com/farukalpay/hormuz-tectonochemical-engine/
7•festafin•1h ago•1 comments

Anthropic Mythos 0-days replicated with GPT5.4

https://twitter.com/kannthu1/status/2042695741844619502
2•knivets•1h ago•0 comments

Dario – use your Claude Max subscription as an API (no API key needed)

https://github.com/askalf/dario
3•askalf•1h ago•2 comments

Show HN: Collabmem – a memory system for long-term collaboration with AI

https://github.com/visionscaper/collabmem
5•visionscaper•1h ago•1 comments

Is ChatGPT Down?

https://chatgpt.com/
4•laser9•1h ago•1 comments

We gave an AI a 3-year Lease. It opened a store

https://andonlabs.com/blog/andon-market-launch
3•lukaspetersson•1h ago•0 comments

Anthropic loses appeals court bid to temporarily block DoD ruling

https://www.cnbc.com/2026/04/08/anthropic-pentagon-court-ruling-supply-chain-risk.html
1•gmays•1h ago•1 comments