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

How Can America Be So Miserable When It's So Rich?

https://www.nytimes.com/2026/03/26/opinion/economy-attitudes-republicans-democrats.html
2•simonebrunozzi•40s ago•0 comments

Old-Games.com

https://www.old-games.com/
2•helloplanets•53s ago•0 comments

Algorithms, Neo-Brokers, and Political Power Reshaping Who Wins on Wall Street

https://respublica.media/the-rigged-casino/
1•amadeuspagel•1m ago•0 comments

An LLM's not going to tell you no (2024)

https://derekkedziora.com/notes/2024-12-11-an-llms-not-going-to-tell-you-no
1•speckx•2m ago•0 comments

Families are fed up with social media

https://nypost.com/2026/03/25/opinion/legal-double-whammy-is-just-the-start-for-social-media-comp...
1•1vuio0pswjnm7•2m ago•0 comments

Ask HN: Will AI ever be cheap?

1•worldsavior•2m ago•0 comments

The surprising science behind red-light therapy – and how it works

https://www.nature.com/articles/d41586-026-00878-1
1•mikhael•3m ago•0 comments

You shouldn't use ultrathink in Claude Code

https://www.claudecodecamp.com/p/claude-code-extended-thinking
3•aray07•3m ago•0 comments

Building a Blog with Elixir and Phoenix

https://jola.dev/posts/building-a-blog-with-elixir-and-phoenix
4•shintoist•3m ago•0 comments

Unit: A self-replicating Forth mesh agent running in a browser tab

https://davidcanhelp.github.io/unit/
1•DavidCanHelp•4m ago•0 comments

Scientists discover popular diabetic drug's unexpected effect on the brain

https://timesofindia.indiatimes.com/etimes/wellness/scientists-discover-popular-diabetic-drugs-un...
1•01-_-•5m ago•0 comments

CDC plans hiring push to fill gaps from last year's widespread layoffs

https://federalnewsnetwork.com/workforce/2026/03/cdc-plans-hiring-push-to-fill-gaps-from-last-yea...
1•starkparker•5m ago•0 comments

Spotify and Labels Seek $322M Default Judgment Against Anna's Archive

https://torrentfreak.com/spotify-and-labels-seek-322-million-default-judgment-against-annas-archive/
2•Cider9986•7m ago•0 comments

Germany's Merz floats EU-China trade deal as European capitals soften on Beijing

https://www.scmp.com/news/china/diplomacy/article/3348030/germanys-merz-floats-eu-china-trade-dea...
1•vrganj•7m ago•0 comments

Online legal database CanLII and AI startup Caseway settle copyright dispute

https://betakit.com/online-legal-database-canlii-and-ai-startup-caseway-settle-copyright-dispute/
2•ClearwayLaw•7m ago•1 comments

Text Reconstruction via Subtle Vibrations from Videos

https://www.mdpi.com/1424-8220/26/5/1407
1•PaulHoule•8m ago•0 comments

The surprising photographers behind Google screensavers

https://blog.google/products-and-platforms/platforms/google-tv/google-devices-screensavers-photog...
1•gnabgib•8m ago•0 comments

Ask HN: How do people control Claude Code on the go nowadays on the go?

1•moropex•9m ago•0 comments

Remote SQLite access your remote SQLite databases locally

https://remotesqlite.com
2•cloudmanic•11m ago•1 comments

Army extends maximum recruitment age to 42, allowing older recruits to join

https://abcnews.com/Politics/army-extends-maximum-recruitment-age-42-allowing-older/story?id=1314...
4•mindracer•11m ago•2 comments

Deploying MuJoCo on Azure ML: Surprising Pain Points

https://www.hapticlabs.ai/blog/2026/03/21/deploying-mujoco-on-azure-ml
3•mexitlan•12m ago•0 comments

Why LLMs Lie in Different Ways?

https://www.orsonai.com/publications/tes4-four-types-hallucination.html
1•JakubCwi•15m ago•0 comments

System Stability Protocol [REF-333]: Axiomatic Logic and Entropy Minimization

https://archive.org/details/system-stability-protocol-ref-333
1•rogmash•16m ago•0 comments

SuperMicro sued by shareholders over China-related criminal case

https://finance.yahoo.com/markets/stocks/articles/super-micro-sued-shareholders-over-221915291.html
2•irishcoffee•17m ago•1 comments

GLP-1 Anti-Obesity Rx and Alcohol and Substance Use Disorders

https://www.psychologytoday.com/us/blog/addiction-outlook/202602/glp-1-anti-obesity-rx-and-alcoho...
2•PaulHoule•18m ago•0 comments

Android Sets New Record for Mobile Web Performance

https://blog.chromium.org/2026/03/android-sets-new-record-for-mobile-web.html
2•WalterSobchak•18m ago•0 comments

Clojure: The Documentary, official trailer [video]

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

Leadership – Bold Visionary, Technocratic Expert, or Trimmer

https://www.theatlantic.com/ideas/2026/03/make-better-decisions-trimmer/686522/
2•bell-cot•19m ago•1 comments

Helix – Self-healing SDK for AI agent payments

https://github.com/adrianhihi/helix
1•adrianhihi•21m ago•0 comments

Harvey Raises at $11B Valuation

https://www.harvey.ai/blog/harvey-raises-at-dollar11-billion-valuation-to-scale-agents-across-law...
1•skogstokig•21m ago•0 comments