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?

Yavc.App (Yet Another Vibe-Coded App)

https://yavc.app/
1•paulmooreparks•12m ago•0 comments

Leading AI models are biased against certain accents

https://www.washington.edu/news/2026/11/04/ai-models-are-biased-against-certain-accents/
2•giuliomagnifico•13m ago•1 comments

Sex in Britain has changed significantly, especially among young people

https://www.ucl.ac.uk/news/2026/nov/sex-britain-has-changed-significantly-especially-among-young-...
1•giuliomagnifico•16m ago•0 comments

AI Agents Livestream Their Assault on P=NP

https://pequalnp.com/pnp/live
1•extasetoi12•17m ago•0 comments

NOAA Found a Fish Sitting in a Brine Pool at the Bottom of the Gulf [video]

https://www.youtube.com/watch?v=i9J1EmGTezk
1•zeristor•19m ago•0 comments

The Monumental Achievement of the Stanford Encyclopedia of Philosophy

https://www.newyorker.com/culture/annals-of-inquiry/the-monumental-achievement-of-the-stanford-en...
1•rbanffy•21m ago•0 comments

Counting "Go" on Hacker News, using a Jev-like decision model

https://github.com/ianTPE/hn-topic-race/blob/main/docs/counting-go.md
1•iantpe•24m ago•1 comments

Welcome to Soviet Union 2.0, comrade

https://nibblestew.blogspot.com/2026/11/welcome-to-soviet-union-20-comrade.html
2•ibobev•32m ago•0 comments

Satmux: 3.6x faster inflight Wi-Fi via BBR TCP multiplexing

https://github.com/Th0rgal/satmux
3•joshcsimmons•32m ago•0 comments

Schneier: Tracking incidents of hacking using AI tools

https://www.schneier.com/blog/archives/2026/11/tracking-incidents-of-hacking-using-ai-tools.html
2•thamiltonsmith•34m ago•0 comments

Show HN: Nuv1, a real time animated character on ESP32-S3 board

https://nuv1.com/
1•NuvolaProject•34m ago•0 comments

Can I use QEMU untrusted?

1•logicallee•37m ago•0 comments

Why optimistic UI updates are corrosive

https://datastar-instant-intent.ndyg.cross.stream/corrosive/
2•fanf2•40m ago•0 comments

Classic Shift Ciphers with `lens` and `finite-typelits`

https://jackkelly.name/blog/archives/2026/11/26/classic_shift_ciphers_with_lens_and_finite-typeli...
1•ibobev•40m ago•0 comments

Show HN: CouncilTaxCost – 2026/27 UK Council Tax and 1991 HPI Band Calculator

https://counciltaxcost.co.uk/tools
1•hacphong•45m ago•0 comments

Top Cobalt Miner Congo to Ban Exports Again as Prices Fall

https://www.bloomberg.com/news/articles/2026-11-23/top-cobalt-producer-congo-will-ban-exports-aga...
1•tosh•46m ago•0 comments

Why Mercedes Is Trying to Build an EV Battery Without Cobalt

https://www.autoweek.com/news/a74444024/mercedes-trying-to-build-ev-battery-without-cobalt/
1•tosh•47m ago•0 comments

AgentTrust KYE – 6 days of probing remote MCP servers (41% > 500ms)

https://github.com/heroson86462-hsnu/agenttrust-kye
1•Heroson86462•47m ago•0 comments

Show HN: Sylence – match your tinnitus pitch, then hear noise notched at it

https://sylence.app/tinnitus-frequency-finder/
2•kyrillos50•47m ago•0 comments

Show HN: Google Maps Leads Scraper – open-source, searches an area tile by tile

https://github.com/userisaziz/google-maps-leads-scraper
1•Userisaziz•48m ago•0 comments

North Korea built the best army of hackers

https://www.cnn.com/2026/11/29/asia/north-korea-hacking-capabilities-intl-hnk-dst
1•extasetoi12•50m ago•1 comments

Ask HN: Will Intel Succeeded?

1•roschdal•50m ago•0 comments

Starmind: Shooting the AI datacenter into space. Why?

https://neatread.net/starmind-shooting-the-ai-datacenter-into-space-why
1•piter691777•51m ago•1 comments

Australia's duty of care law lets platforms assess their own safety risks

https://ajaychavda.com/blog/australia-s-duty-of-care-law-lets-platforms-assess-their-own-safety-r...
1•romania1•53m ago•1 comments

Faceball – a try new things experiment

https://trynewthings.fail/experiments/faceball/
1•fjallstrom•57m ago•0 comments

The Death of TTPs – Autonomous Cyber Attacks in the Wild [video]

https://www.youtube.com/watch?v=7q7CSxntccw
1•_voidtrace•59m ago•0 comments

The Cognitive Art of Feynman Diagrams (eBook) – Edward R. Tufte

https://www.edwardtufte.com/book/the-cognitive-art-of-fyenman-diagrams-ebook/
2•icc97•1h ago•0 comments

Ten tracks from the game of my childhood

https://www.openstreetmap.org/user/darkonus/diary/409740
2•altilunium•1h ago•0 comments

The backlash over 'fake' assistance dogs

https://www.bbc.co.uk/news/articles/ck1l0e2rdyd1o
2•mellosouls•1h ago•0 comments

What the Top Roblox Games Put on Their Game Page (2026 Data Study)

https://rbxgfx.com/blog/roblox-top-games-thumbnails-study
1•visiohex•1h ago•0 comments