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?

LLM Agents Can Easily Tamper with Their Own Traces

https://arxiv.org/abs/2609.30266
1•sbulaev•5m ago•0 comments

An Introduction to Lithium Niobate Nanophotonics (2024)

https://www.latitudeds.com/post/an-introduction-to-lithium-niobate-nanophotonics
1•peter_d_sherman•5m ago•0 comments

Valley fever spreading to Central Valley cities, linked to oil drilling

https://www.latimes.com/science/story/2026-09-24/valley-fever-spreading-to-central-valley-cities-...
2•littlexsparkee•7m ago•0 comments

Show HN: Try SpikeUI (for free) and make .exe apps the easy way

https://nimoxi.com/spikeui/
1•Caronte3D•24m ago•0 comments

Ten Years of the Creative Independent

https://thecreativeindependent.com/ten-years/
1•cookingoils•25m ago•0 comments

Wall-mounted vegetable garden growing peppers over 2 meters tall [video]

https://www.youtube.com/watch?v=Wvb52q9TKKM
3•moltean•25m ago•0 comments

Qualcomm Unveils Snapdragon 8 Elite Gen 6 and Elite Extreme Gen 6

https://www.servethehome.com/qualcomm-unveils-snapdragon-8-elite-gen-6-and-elite-extreme-gen-6-ne...
1•cisc•33m ago•0 comments

Details of how Tumbler Ridge mass shooter used ChatGPT

https://www.cbc.ca/news/canada/british-columbia/mother-jones-chatgpt-safeguards-tumbler-ridge-bc-...
2•Alien1Being•35m ago•0 comments

Show HN: Twitter GIF Downloader and Conversation Browser-Based

https://twitee.co/twitter-gif-downloader
1•nohuman-labs•37m ago•0 comments

Getting root on OnePlus 15 from an untrusted app

https://blog.nns.ee/2026/09/24/oneplus-root/
1•shscs911•39m ago•0 comments

The Hannibal Directive

https://en.wikipedia.org/wiki/Hannibal_Directive
2•chasil•49m ago•1 comments

A free, keyless MCP Server for CVE data and per-CVE internet Exposure

1•echelongraph•59m ago•0 comments

Reelizer: Film Art, Curated

https://www.reelizer.com/about
1•thecosas•1h ago•0 comments

Stanford research suggests human brain might be two organs fused together

https://caliber.az/en/post/stanford-research-suggests-human-brain-might-be-two-organs-fused-together
2•wellpast•1h ago•1 comments

Earth microbes survive simulated conditions of Saturn moon's ocean

https://www.theguardian.com/science/2026/sep/25/earth-microbes-survive-conditions-enceladus-satur...
2•saikatsg•1h ago•0 comments

Technology and Marketing Law Blog

https://blog.ericgoldman.org/
3•peter_d_sherman•1h ago•0 comments

One, Two, Three, Eyes on Me (2017)

https://www.lrb.co.uk/the-paper/v39/n19/george-duoblys/one-two-three-eyes-on-me
2•Tomte•1h ago•0 comments

Show HN: The City – a native Mac app that shows Claude Code as a city of robots

https://github.com/Slaymish/theCity
1•slaymish•1h ago•0 comments

Show HN: Esh – English to Shell

https://github.com/numericalworks/esh
1•mindaslab•1h ago•0 comments

Unusual earthquake activity detected at site of former N. Korea nuclear facility

https://www.independent.co.uk/news/science/earthquake-north-korea-nuclear-mountain-mantap-b305227...
2•saikatsg•1h ago•0 comments

Online Sound Meter

https://asoundmeter.com/
1•artiomartiom•1h ago•0 comments

Citizenship Restored (2023)

https://www.lrb.co.uk/the-paper/v45/n18/daniel-trilling/diary
2•Tomte•1h ago•0 comments

Show HN: Practice ordering ramen from a Japanese ticket machine

https://ajin.im/is/building/kenbaiki/
1•poppypetalmask•1h ago•0 comments

The rise of the Jim Crow theobros

https://religionnews.com/2026/09/24/the-rise-of-the-jim-crow-theobros/
1•Anon84•1h ago•0 comments

Eikos - OSS Jev-like model

https://github.com/caiovicentino/eikos
1•emersonrsantos•1h ago•0 comments

Eliza Effect

https://en.wikipedia.org/wiki/ELIZA_effect
1•extr0pian•1h ago•0 comments

Solomon's Paradox

https://en.wikipedia.org/wiki/Solomon%27s_paradox
2•thelastgallon•1h ago•0 comments

Linux Unreal Tournament 2003 Master Server patch + Ultrawide and No Sound Fix

https://github.com/rokyed/ut2003-ultrawide-screen-patch
2•rokyed•1h ago•0 comments

Perfectly Replicating Red Bull Then Making It Caffeine-Free [video]

https://www.youtube.com/watch?v=7pTqGJ3KSLE
1•gw32•1h ago•0 comments

Hermann Weyl – Frank Aydelotte memorandum (1945)

https://albert.ias.edu/server/api/core/bitstreams/9feac6ca-38d1-4f5c-9876-75915f1a5762/content
1•georgecmu•1h ago•0 comments