frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Ask HN: How can I load test PostgreSQL but avoid changing actual data?

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

Smoking accessories are making a comeback

https://www.admiddleeast.com/story/the-most-controversial-trend-of-2026-smoking-accessories-are-m...
1•Pamar•1m ago•0 comments

Startup Lumilens Raises $700M to Replace Data-Center Wires with Light

https://www.wsj.com/tech/startup-raises-700-million-to-replace-data-center-wires-with-light-adc74358
2•bookofjoe•4m ago•1 comments

What If Wishes Could Be Bought and Sold?

https://www.newyorker.com/books/page-turner/what-if-wishes-could-be-bought-and-sold
1•Anon84•7m ago•0 comments

AI Tool Directory

1•lokeshjoshi•7m ago•0 comments

Pyhctsa – Highly comparative time-series analysis

https://github.com/DynamicsAndNeuralSystems/pyhctsa/
1•jmoo2880•10m ago•0 comments

Show HN: Tape Music Hub, local music library manager with a P2P phone companion

https://tape-music-hub.gordo.design/
1•sergormo•10m ago•0 comments

Mailüfterl (Early Transistorized Computer)

https://en.wikipedia.org/wiki/Mail%C3%BCfterl
1•wolfi1•11m ago•0 comments

Run Gitea Actions on Apple Hardware

https://github.com/markwylde/gitea-runner-lume
2•turblety•11m ago•0 comments

Birdsong follows a fundamental law of human language

https://www.scientificamerican.com/article/birdsong-follows-a-fundamental-law-of-human-language/
1•1659447091•12m ago•0 comments

BMW Rolling Out In-Car Spam

https://www.heise.de/en/news/BMW-Annoyed-by-Advertising-11399005.html
2•lschueller•15m ago•0 comments

The AI Experts Who Couldn't Predict AI

https://greyenlightenment.com/2026/07/26/the-ai-experts-who-couldnt-predict-ai/
1•paulpauper•16m ago•0 comments

Models may behave differently in graded episodes (a tirade)

https://www.lesswrong.com/posts/AfoGGrJfuNzofpzWL/models-may-behave-differently-in-graded-episode...
1•paulpauper•16m ago•0 comments

Claude Code sessions can now message each other

https://twitter.com/ClaudeDevs/status/2085817074816070014
2•shpat•17m ago•0 comments

Lost my phone at the office. Claude suggested tracking Bluetooth signal strength

https://twitter.com/un1c0rnioz/status/2084686552299634805
1•ilamont•20m ago•0 comments

China's A.I. Is Surging Across Africa. That Should Worry Silicon Valley

https://www.nytimes.com/2026/08/05/technology/ai-china-africa.html
1•ripe•22m ago•1 comments

Chasa

https://chasa.io/
3•docracy•22m ago•0 comments

Making an agile version of a Windows Runtime delegate in C++/WinRT, part 10

https://devblogs.microsoft.com/oldnewthing/20260731-00/?p=112578
1•ibobev•25m ago•0 comments

BingeBuster

https://bingebuster.net/
1•rdoherty•27m ago•0 comments

The Statistics Behind the Jason Arday Scandal

https://www.compactmag.com/article/the-statistics-behind-the-jason-arday-scandal/
1•barry-cotter•27m ago•0 comments

Creating a fake agile wrapper that is technically agile

https://devblogs.microsoft.com/oldnewthing/20260806-00/?p=112595
1•ibobev•27m ago•0 comments

Soppo – Go, with the features it's missing

https://soppolang.dev/
1•birdculture•28m ago•0 comments

Your AI Frustration Is My Opportunity

https://metedata.substack.com/p/012-your-ai-frustration-is-my-opportunity
3•young_mete•29m ago•0 comments

Show HN: Public Web Change Intelligence

https://app.monity.ai
1•kamilmm21•29m ago•0 comments

Super Mario Derivations

https://fzakaria.com/2026/08/05/super-mario-derivations
1•domenkozar•29m ago•0 comments

KV Cache vs. Prompt Cache: What's the Difference, and How Are They Related?

https://jaketao.com/language/en/kv-cache-vs-prompt-cache/
1•taojing10•30m ago•0 comments

From Chat Completions to Responses: Why Is OpenAI Upgrading Its Core API?

https://jaketao.com/language/en/why-openai-upgrading-api/
1•taojing10•31m ago•0 comments

Live Coronal Prediction – 2026 Total Solar Eclipse

https://eclipse.predsci.com/
1•corlinp•32m ago•1 comments

Argentine company accuses US of meddling in Huawei project

https://www.ft.com/content/051e6fbf-e796-4b92-9c6e-7b85c74e8edc
1•wslh•32m ago•1 comments

Health factors that delay dementia for up to 13 years

https://www.nbcnews.com/health/aging/delay-dementia-health-factors-diabetes-blood-pressure-smokin...
2•elo2000•32m ago•0 comments

Water utilities group partners with DEF CON offshoot for Water Watch Center

https://therecord.media/water-watch-center-utilities-def-con-franklin-nrwa
1•speckx•37m ago•0 comments