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•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?

Yum Brands, Nvidia will deploy new AI at 500 restaurants

https://www.restaurantdive.com/news/yum-brands-nvidia-ai-taco-bell-pizza-hut-kfc-deal/742926/
2•littlexsparkee•11m ago•0 comments

pocket – A dead-simple file clipboard for your terminal

https://github.com/pasc4le-ai-sandbox/pocket
1•pasc4le•13m ago•1 comments

Museum of Imaginary Musical Instruments

https://imaginaryinstruments.org/
1•bookofjoe•18m ago•0 comments

Stop paying $360/year to access your own email history

https://mailvaulty.com
1•khaledsabae•22m ago•0 comments

My Thoughts on Bun's Rust Rewrite

https://en.liujiacai.net/2026/05/16/bun-rust-port/
1•birdculture•24m ago•0 comments

Why raw RPC logs are not enough for trading infrastructure

https://blog.bridgexapi.io/behavior-reconstruction-vs-token-scanners
1•Bridgexapi•25m ago•0 comments

EDR vendors: source code access (3), staged updates (8), SBoM rare

https://av-comparatives.org/independent-study-highlights-transparency-and-data-practices-in-leadi...
1•YorkiRima•26m ago•0 comments

Reverse engineering Android malware from popular Chinese projectors

https://zanestjohn.com/blog/reing-with-claude-code
1•3abiton•28m ago•0 comments

What's inside an AI agent: a 300~ LoC ReAct loop

https://quantumentangled.dev/viewpost/11/whats-actually-inside-an-ai-agent-a-300-loc-react-loop
1•rulyone•30m ago•0 comments

Academia, startups, big tech, and back again

https://austinhenley.com/blog/academiastartupsbigtech.html
2•azhenley•34m ago•0 comments

How to use codex to get the most out of it

https://jxnl.co/writing/2026/05/10/codex-maxxing/
4•gizmodo59•37m ago•0 comments

Designing an FPGA Calculator from Scratch

https://baltazarstudios.com/calculator/
1•zdw•38m ago•0 comments

Cats Lock – keyboard lock for cat people

https://catslock.app
2•zdw•39m ago•0 comments

Shigeru Miyamoto has probably never compiled a line of code in his life

https://indiepixel.de/blog/posts/shigeru-miyamoto-has-probably-never-compiled-a-line-of-code-in-h...
2•gizmo64k•41m ago•0 comments

Ask HN: My side project has 5 happy paying customers. How do I get more?

https://classbuddy.io/home
1•sreedhar•43m ago•2 comments

Show HN: Track 10x bathroom tile developer status across code forges with Hugo

https://github.com/aselimov/-hugo-unified-git-activity
1•aselimov3•43m ago•0 comments

A Self-Hosting Point-and-Click Editor for Any GUI-DB Application [pdf]

https://michaelawhite.net/files/whitepaper.pdf
1•mwhite•47m ago•1 comments

Replacing Google Analytics with Matomo on a Pi in a Cupboard

https://alexlance.blog/analytics.html
2•alance•49m ago•0 comments

The LLM Looked Smart. The Metrics Disagreed

https://tiago.rio.br/work/general/articles/llm-looked-smart-metrics-disagreed/
1•timotta•53m ago•0 comments

Why does Amazon have no Western rivals?

https://www.bbc.com/news/articles/cg7p5nr307mo
2•dabinat•53m ago•1 comments

3D R/Place

https://outer.one
1•mikidoodle•54m ago•0 comments

Found the song from the viral runway watch ad with 110M Instagram views

https://www.youtube.com/watch?v=uF7lmsP3vJY
2•marcelix•57m ago•3 comments

188,000 Show HN posts, 14 years of data: what predicts GitHub stars

https://danfking.github.io/blog/2026/04/23/show-hn-by-the-numbers/
2•BundyBear•1h ago•0 comments

Hypen – Declarative UI Language for Cross-Platform Development

https://hypen.space/introducing-hypen
2•ravenical•1h ago•0 comments

Show HN: Cheap-IM – CPU-only voice agent approximating Thinking Machines' demo

https://github.com/kouhxp/cheap-im
1•mrkn1•1h ago•0 comments

Zero, a systems language for small native agent tools

https://github.com/vercel-labs/zero
1•mjgil•1h ago•0 comments

ZeroBloat: Open-source desktop app for removing Android bloatware

https://github.com/AdhwaithAS/ZeroBloat
2•pentagrama•1h ago•0 comments

Show HN: Building ClueDay, a daily clue-based word-game

https://tanyagupta10.substack.com/p/if-you-havent-vibecoded-already-build
1•tannyc•1h ago•0 comments

Target can't measure their own bins

https://ninjacheetah.dev/2026/05/17/target-cant-measure.html
3•argee•1h ago•0 comments

Searching "remove definition" on Google results in pointless AI text

https://www.google.com/search?q=remove+definition
2•tech234a•1h ago•0 comments