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?

Catholic expert: "Security issues show AI needs greater human oversight"

https://www.detroitcatholic.com/news/security-issues-show-ai-needs-greater-human-oversight-say-ca...
1•supportm•1m ago•0 comments

Termdom – Build Terminal Apps with HTML, CSS and the DOM

https://termdom.org
1•philips•2m ago•0 comments

The Surveillance Network Tracking Cars Across the U.S.

https://www.nytimes.com/video/us/100000011056273/the-surveillance-network-tracking-cars-across-th...
2•bookofjoe•3m ago•1 comments

Nvidia AI Factory Compute Is Becoming an Investable Asset Class

https://twitter.com/JensenHuang/status/2086934705207959965
1•jawiggins•5m ago•0 comments

Tracking down a Zsh history data loss bug

https://michael.stapelberg.ch/posts/2026-08-09-zsh-history-truncation-bug/
1•birdculture•5m ago•0 comments

Wreck of Royal Navy warship HMS Tiger found off Isle of Wight after 118 years

https://news.sky.com/story/wreck-of-royal-navy-warship-hms-tiger-found-off-isle-of-wight-after-11...
1•austinallegro•6m ago•0 comments

Archer to Acquire Boeing's Wisk Aero, Insitu and SkyGrid

https://investors.archer.com/news/news-details/2026/Archer-Announces-Second-Quarter-2026-Results-...
3•MrVitaliy•9m ago•0 comments

Control and complexity: tension in systems design

https://ferd.ca/control-and-complexity-tension-in-systems-design.html
2•billiob•9m ago•0 comments

Wall Street giants partner with Nvidia on $500B AI financing deal

https://www.ft.com/content/98a8fd17-15b6-4f67-9cb4-825722b11348
4•aanet•10m ago•2 comments

Watch out for cache read costs

https://martinalderson.com/posts/watch-out-for-cache-read-costs/
1•martinald•11m ago•0 comments

NYC, MTA eye first-of-its-kind plan that might keep subway platforms cooler

https://www.cbsnews.com/newyork/news/nyc-mta-subway-platforms-hot-weather-study/
2•thunderbong•13m ago•0 comments

Show HN: AI Pulse a fake LED strip beside the macOS Dock that shows agent status

https://github.com/leog/ai-pulse
1•leog_me•17m ago•0 comments

Tokenisation: Who decides what a token is anyway?

https://idlemachines.co.uk/essays/tokenisation
1•smaddrellmander•19m ago•0 comments

From backpacks to food, consumer goods are getting worse

https://www.theguardian.com/us-news/2026/aug/10/consumed-consumer-goods-quality
4•petethomas•20m ago•0 comments

AI framework rooted in cognitive science could complete tasks more efficiently

https://techxplore.com/news/2026-07-ai-framework-rooted-cognitive-science.html
1•1659447091•20m ago•0 comments

You Are the Superintelligence

http://unsoliciteddave.blogspot.com/2026/08/you-are-superintelligence.html
3•DaveParkCity•24m ago•0 comments

Whats: A CLI command explainer, pure man pages, –help outputs

https://github.com/iamkaran/whats
3•thunderbong•26m ago•0 comments

Python's pre-declared constants are kinda weird

https://sebsite.pw/w/20260801-pythonconstants.html
1•Ravencentric•26m ago•0 comments

Convictional (YC W19) is shutting down

https://get.convictional.com/posts/convictional-is-shutting-down/
1•barronlroth•26m ago•1 comments

Zuck rekindles open weights Llama drama with Muse Glimmer

https://www.theregister.com/ai-and-ml/2026/08/10/zuck-rekindles-open-weights-llama-drama-with-mus...
1•joebuckwilliams•29m ago•1 comments

Making Need for Speed 2015 using Game Maker [video]

https://www.youtube.com/watch?v=ffGqjOBowIc
1•linkdd•31m ago•0 comments

Show HN: Typegres 0.3 – SQL-as-your-API, safely (using Cap'n Web RPC)

https://typegres.com/
2•ryanrasti•35m ago•0 comments

Show HN: Calldiff – a CLI to see callstack diffs in all major languages

https://github.com/tanishqkancharla/calldiff
1•tanishqkanc•38m ago•0 comments

Traffic to Trump's Truth Social Falls Sharply This Summer

https://www.nytimes.com/2026/08/10/business/trump-truth-social-traffic-declines.html
4•duxup•38m ago•3 comments

Show HN: Keen Code – an agentic-engineered coding agent

https://github.com/mochow13/keen-code
3•mochow13•38m ago•1 comments

Joining Cursor

https://arslan.io/2026/08/10/joining-cursor/
3•sagacity•40m ago•0 comments

Reflex XY – a Python charting library for interactive 2D visualizations

https://reflex.dev/docs/xy/
1•aanet•41m ago•1 comments

Outsiders Pay $6,500 to Learn Southern Sorority Rush's Unwritten Rules

https://www.bloomberg.com/news/articles/2026-08-10/what-is-sorority-rush-and-why-are-parents-payi...
2•alephnerd•41m ago•0 comments

Show HN: Bananarr – Technology Profiler – Chrome Extension

https://bananarr.com/
1•ernsheong•43m ago•0 comments

Show HN: My local climbing gym from photogrammetry

https://kmcheung12.github.io/climb-preview/tour/ae43c6e5
2•a_c•46m ago•0 comments