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

I opened a bookshop. It was the best, worst thing I've ever done

https://www.ft.com/content/cc77c2c9-3415-4b96-af76-65f04d761a85
1•Brajeshwar•2m ago•0 comments

Gust a fast, rust based Swift package manager

https://github.com/quantbagel/gust
1•quantbagel•5m ago•0 comments

Survival of the Mediocre Mediocre (2018)

https://www.ribbonfarm.com/2018/04/24/survival-of-the-mediocre-mediocre/
2•Ariarule•6m ago•0 comments

Multiscale Aperture Synthesis Imager

https://hbr.org/2025/07/hybrid-still-isnt-working
1•wisty•11m ago•2 comments

Favorite Compiler and Interpreter Resources

https://eatonphil.com/compilers-and-interpreters.html
1•ibobev•12m ago•1 comments

How to use a specific version of MSVC in GitHub Actions

https://blog.ganets.ky/MsvcGha/
1•ibobev•12m ago•0 comments

Load and store forwarding in the Toy Optimizer

https://bernsteinbear.com/blog/toy-load-store/
1•ibobev•12m ago•0 comments

Why Britain has a deer problem – leaving damage that costs millions

https://www.bbc.co.uk/news/articles/c9d93xzey70o
2•zeristor•16m ago•0 comments

Humidity Calculator for Quick Cold Snaps

https://www.humidsnap.com/
2•saikiran91•21m ago•1 comments

The Promise of P-Graphs

https://pavpanchekha.com/blog/p-graphs.html
2•PaulHoule•24m ago•0 comments

The impact of nerve injury on the immune system in mice is sexually dimorphic

https://www.sciencedirect.com/science/article/pii/S2452073X25000170
2•bookofjoe•27m ago•0 comments

F-Droid bans Gab for being a "free speech zone" that "tolerates all opinions"

https://reclaimthenet.org/f-droid-bans-gab-app
3•like_any_other•28m ago•0 comments

AI Gets an Innocent Man Arrested [video]

https://www.youtube.com/watch?v=B9M4F_U1eEw
3•esaym•31m ago•0 comments

The battle to stop clever people betting

https://www.economist.com/christmas-specials/2025/12/18/the-battle-to-stop-clever-people-betting
2•Anon84•31m ago•2 comments

MiniMax M2.1: Built for Real-World Complex Tasks, Multi-Language Programming

https://www.minimaxi.com/news/minimax-m21
14•110•34m ago•0 comments

The Nine Days Paul McCartney Spent in a Tokyo Jail

https://www.utterlyinteresting.com/post/the-nine-days-paul-mccartney-spent-in-a-tokyo-jail
1•handfuloflight•35m ago•0 comments

Show HN: Filenest – Desktop File Organizer

https://filenest.tech
1•Ilikeruby•35m ago•0 comments

VFlight Insurance Vending Machine

https://airandspace.si.edu/multimedia-gallery/14310hjpg
1•handfuloflight•37m ago•0 comments

Holiday 2025 Usage Promotion

https://support.claude.com/en/articles/13163666-holiday-2025-usage-promotion
1•shepherdjerred•37m ago•0 comments

Faster Rust Builds on Mac

https://nnethercote.github.io/2025/09/04/faster-rust-builds-on-mac.html
1•luispa•38m ago•0 comments

Governments in the West Are Turning Their Sights on VPNs

https://www.nakedcapitalism.com/2025/12/in-their-total-war-on-online-privacy-the-liberal-democrac...
2•indigodaddy•39m ago•0 comments

Automating What Backblaze Lifecycle Rules Don't Do Instantly

https://blog.tymscar.com/posts/backblazeb2cleanup/
2•tymscar•42m ago•0 comments

Creating Your Own Website

https://32bit.cafe/cyowebsite/
1•susam•45m ago•0 comments

Above Black

https://www.amazon.com/ABOVE-BLACK-Preserve-Insiders-Government-ebook/dp/B003L77MUU
1•handfuloflight•46m ago•0 comments

Knuth Christmas Lecture: Adventures with Knight's Tours (2025) [video]

https://www.youtube.com/watch?v=MKiRte-tnMY
4•nmwnmw•48m ago•0 comments

A Brief History of Roombas with Fart Spray

https://taylor.town/roombas-with-fart-spray
3•gregwolanski•49m ago•0 comments

Ask HN: Why do some people feel emotionally attached to AI models

7•ClipNoteBook•53m ago•2 comments

Steam, Steel, and Infinite Minds

https://twitter.com/ivanhzhao/status/2003192654545539400
2•gmays•56m ago•0 comments

Show HN: Visual interface for AI agents beyond text-only chat

https://github.com/Zabaca/pane
2•uptownhr•57m ago•1 comments

Are Two Heads Better Than One?

https://eieio.games/blog/two-heads-arent-better-than-one/
1•zdw•59m ago•0 comments