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?

A device that revives eyeballs from dead donors could make eye transplants poss

https://www.technologyreview.com/2026/07/03/1140148/a-device-that-revives-eyeballs-from-dead-dono...
1•joozio•2m ago•0 comments

Show HN: FlipFlow FlipFlow turns PDF, Word, and images into flipbooks

https://flippingbooks.org
1•ceaserwang•3m ago•0 comments

Fable 5. Safety Taken to an Extreme

1•sergeysmirnov•4m ago•0 comments

HTML Is the New PowerPoint

https://sproutmarkup.com/
1•ginooliver•4m ago•0 comments

More Tailscale tricks for your jailbroken Kindle

https://tailscale.com/blog/jailbroken-kindle-proxy-tun-modes
1•Quizzical4230•5m ago•0 comments

Running Qwen 3.6 Locally on a Mac Mini M4 with 16GB RAM

https://maloyan.xyz/blog/running-qwen-locally-mac-mini-m4
1•mpweiher•7m ago•0 comments

What's new in Claude Sonnet 5

https://platform.claude.com/docs/en/about-claude/models/whats-new-sonnet-5
1•tosh•8m ago•0 comments

Is DentaBiome Legit? Full Oral Postbiotic Review 2026

https://gamma.app/embed/Is-DentaBiome-Legit-Full-Oral-Postbiotic-Review-2026-ngcts4rx0fndxw5?mode...
1•prepostseo•12m ago•0 comments

Accessible Math in PDF [video]

https://www.youtube.com/watch?v=yb5QElBAr-Q
1•anewhnaccount2•21m ago•0 comments

The LLVM Compiler Infrastructure

https://cacm.acm.org/federal-funding-of-academic-research/the-llvm-compiler-infrastructure/
1•tosh•23m ago•0 comments

Open source project for evaluating two models on specific task

1•mzubairtahir•27m ago•0 comments

Mir Little Mathematics Library

https://mirtitles.org/2011/06/02/little-mathematics-library/
1•vismit2000•27m ago•0 comments

Show HN: On99 – a no-signup Hong Kong Mark Six checker and stats explorer

https://on99.life/en/lottery
1•alex_foolsmart•31m ago•0 comments

Godot bans "vibe-coded" code contributions

https://theguptalog.blogspot.com/2026/07/godot-bans-ai-generated-code.html
2•guptalog•33m ago•1 comments

Show HN: Much – Local-first AI workspace with in-browser Python (WASM) sandbox

1•srinivasthalada•34m ago•0 comments

The bottleneck might be the air in the room

https://blog.mikebowler.ca/2026/07/03/co2-and-decision-making/
15•gslin•34m ago•1 comments

Borrowed Confidence

https://zhavaedhaemaed.substack.com/p/borrowed-confidence
1•vismit2000•38m ago•0 comments

The feature in OxCaml that more languages should steal

https://theconsensus.dev/p/2026/06/27/the-feature-in-oxcaml-more-languages-should-steal.html
1•tosh•41m ago•0 comments

Now at $50M: Ro Khanna "Why I Support a Billionaire Wealth Tax"

https://rokhannausa.substack.com/p/why-i-support-a-billionaire-wealth
2•g42gregory•45m ago•0 comments

OpenClaw just launched an official app for iPhone

https://9to5mac.com/2026/06/29/openclaw-just-launched-an-official-app-for-iphone-details-here/
1•TMWNN•46m ago•0 comments

I Helped Fact-Check the 1619 Project. The Times Ignored Me. (2020)

https://www.politico.com/news/magazine/2020/03/06/1619-project-new-york-times-mistake-122248
1•Tomte•46m ago•0 comments

Help Us Save MeshCore

https://blog.meshcore.io/2026/07/04/help-us-save-meshcore
1•ilreb•48m ago•0 comments

Berikut cara perubahan tiket AGODA

https://drive.google.com/file/d/1jtjTxNKMww-bAiMbr1SqRwrP7Kwn5wk8/view?usp=drivesdk
1•akupadamu•50m ago•0 comments

Bloomberg Terminal Is Ugly and Clunky–Everyone Still Uses It

https://oztalking.com/en/issues/bloomberg-terminal-lock-in
10•haebom•59m ago•2 comments

Alibaba bans Claude Code as a security risk

https://www.scmp.com/tech/big-tech/article/3359375/alibaba-bans-staff-using-claude-code-over-anth...
2•5701652400•1h ago•0 comments

Scientists say they have built a cell from scratch for the first time

https://www.cnn.com/2026/07/01/science/synthetic-cell-research
1•giuliomagnifico•1h ago•0 comments

What Happens When Your Site Goes Down?

https://urlwatch.io/
2•mssblogs•1h ago•0 comments

How AI models would vote in Sweden

https://www.nordan.ai/research/which-swedish-party-do-llms-vote-for
2•urvader•1h ago•1 comments

California Bans 'Sell by' Labels, Hoping to Cut Food Waste

https://www.nytimes.com/2026/07/02/us/california-food-labels-sell-by.html
2•thunderbong•1h ago•1 comments

Movies I've watched. (623 recorded and counting)

https://artconnects.club/u/bora/movies
2•kaizenb•1h ago•3 comments