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

"attention is all you need" in screen recording [video]

https://www.youtube.com/watch?v=FMucMp2kU-8&list=PLbUXLHqCDLr3j_WrCB6q5EkEZmimqcGVC&index=2
1•jiabins0303•1m ago•0 comments

MacBook Neo isn't innovation: It's Apple correcting a story it pushed for years

https://www.windowscentral.com/hardware/apple/the-macbook-neo-isnt-innovation-its-apple-finally-o...
1•bentocorp•4m ago•0 comments

The Expensive Thing

https://ajeygore.in/content/the-expensive-thing
1•vinipolicena•4m ago•0 comments

Agent - Native Mac OS X coding ide/harness

https://github.com/macOS26/Agent
1•jv22222•11m ago•0 comments

The AI Market Is Hitting Peak Absurdity

https://garymarcus.substack.com/p/peak-absurdity-part-ii
4•drob518•14m ago•1 comments

Robot Police Dogs Powered by AI Take over Atlanta's Streets

https://www.newsweek.com/robot-police-dogs-powered-by-ai-take-over-atlantas-streets-11782889
2•xoa•16m ago•0 comments

Show HN: I built a Wikipedia based AI deduction game

https://sleuththetruth.com/
1•brikym•17m ago•0 comments

Claude.md Scorer: paste your file, get rubric score and rewrites

https://claude-md-scorer.surge.sh
1•autonomykit•18m ago•0 comments

Durable Object alarm loop: $34k in 8 days, zero users, no platform warning

4•thewillmoss•22m ago•0 comments

Entasis

https://en.wikipedia.org/wiki/Entasis
1•nomilk•24m ago•0 comments

How the Bitcoin protocol works (2013)

https://michaelnielsen.org/ddi/how-the-bitcoin-protocol-actually-works/
1•downbad_•24m ago•0 comments

The first graffiti wall (online)

https://freestencilmaker.com/the-wall
1•superluvdub•26m ago•1 comments

Chinese Electrotech Is the Big Winner in the Iran War

https://paulkrugman.substack.com/p/chinese-electrotech-is-the-big-winner
2•MaysonL•33m ago•0 comments

Pentagon Approaches Automakers, Manufacturers to Boost Weapons Production

https://www.wsj.com/politics/national-security/pentagon-approaches-automakers-manufacturers-to-bo...
2•cwwc•35m ago•0 comments

WebODM – Free and open source drone mapping software

https://webodm.org
1•alligray•44m ago•0 comments

Treasury Secretary Scott Bessent is preparing banks to collect citizenship data

https://www.cnbc.com/2026/04/15/banks-citizenship-data-collection-customer-accounts.html
6•pseudolus•47m ago•0 comments

The Universal Constraint Engine: Neuromorphic Computing Without Neural Networks

https://zenodo.org/records/19600206
2•skinney_uce•49m ago•0 comments

Shares in Allbirds surge after maker of wool sneakers announces pivot to AI

https://www.theguardian.com/business/2026/apr/15/allbirds-stock-ai-pivot
3•i7l•51m ago•1 comments

Tirith – Track your AI API spend with one CLI import

https://github.com/joedaviesio/tirith
1•joedaviesio•51m ago•0 comments

Show HN: The RUM Conjecture Explained [video]

https://www.youtube.com/watch?v=DGoI6T3SGfY
2•rcron•53m ago•0 comments

Amazon worker dies on warehouse floor. Workers told to keep going

https://finance.yahoo.com/sectors/healthcare/articles/just-dont-look-amazon-worker-170000180.html
15•latexr•54m ago•2 comments

YouTube now lets you turn off Shorts

https://www.theverge.com/streaming/912898/youtube-shorts-feed-limit-zero-minutes
54•pentagrama•54m ago•13 comments

Ants Find Food (2003)

https://mute-net.sourceforge.net/howAnts.shtml
1•downbad_•56m ago•3 comments

Substrate Independent

https://github.com/Technologicat/substrate-independent
1•skeledrew•57m ago•0 comments

Zappa: An AI Powered Mitmproxy

https://geohot.github.io//blog/jekyll/update/2026/04/15/zappa-mitmproxy.html
2•__cayenne__•57m ago•0 comments

Anthropic: Stop Shipping. Seriously.

https://www.reddit.com/r/ClaudeAI/s/C9WM4DHtqt
2•IndignantTyrant•1h ago•0 comments

The TL;DR on MCP: Why context matters and how to put it to work

https://www.figma.com/blog/the-tldr-on-mcp/
2•salkahfi•1h ago•0 comments

TruffleRuby 34: Ruby 3.4 Compatibility, 23% Faster Parsing, New 20x Faster

https://truffleruby.dev/blog/truffleruby-34-is-released
1•birdculture•1h ago•0 comments

Atlassian defends firing engineer for suggesting CEO is 'rich jerk'

https://www.afr.com/technology/atlassian-defends-firing-engineer-for-suggesting-ceo-is-rich-jerk-...
21•jamesfinlayson•1h ago•6 comments

Docker Hodgepodge Images

https://www.chainguard.dev/unchained/docker-hodgepodge-images
2•prdonahue•1h ago•0 comments