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?

Ask HN: How do you track development time?

1•phil3k•1m ago•0 comments

A voxel Tokyo in real Japan time – ride the Yamanote line and study Japanese

https://jivx.com/densha
2•momentmaker•2m ago•0 comments

The Renters' Rights Act Information Sheet 2026 [pdf]

https://assets.publishing.service.gov.uk/media/69bc04b8f7b1c24d8e23ce60/The_Renters__Rights_Act_I...
1•susam•4m ago•0 comments

Splash Canvas

https://artsandculture.google.com/experiment/splash-canvas/vQFCtQB7FDnYkA?hl=en
1•charlieirish•4m ago•0 comments

Bruno: An AI Product Manager for Scientists

https://openreview.net/challenge?redirect=%2Fforum%3Fid%3DApsytO0P2P
1•eamag•5m ago•0 comments

AI companies are throwing museums a lifeline. What do they want in return?

https://www.ft.com/content/998152e8-90cd-4d95-ae43-e07b773ab943
1•thm•5m ago•0 comments

The banana as we know it is in trouble

https://www.wbur.org/cognoscenti/2026/07/10/bananas-fungus-fwb-panama-disease-fwb-ethan-gilsdorf
1•geox•6m ago•0 comments

Satsagen – turn popular SDR transceivers into VNA, spectrum analyzer and more

https://www.albfer.com/en/2020/02/21/satsagen-2/
1•yesturi•7m ago•0 comments

GeoLibre – Lightweight Open-Source GIS Platform

https://github.com/opengeos/GeoLibre
2•wertyk•8m ago•0 comments

Antiuniversity Now

https://antiuniversity.org/
1•robtherobber•8m ago•0 comments

Python Is So Slow. Can Julia Solve the Two-Language Problem?

https://www.wired.com/story/python-is-so-slow-can-julia-solve-the-two-language-problem/
1•AndrewDucker•8m ago•0 comments

In Conversation with Chris Engelsman from European Sleeper

https://back-on-track.eu/in-conversation-with-chris-engelsman-from-european-sleeper/
2•robin_reala•9m ago•0 comments

Musk Ate His Words on Anthropic. Follow the Money

https://mrkt30.com/musk-ate-his-words-on-anthropic-follow-the-money/
1•emsidisii•9m ago•0 comments

States to Challenge Paramount-Warner, Larry Ellison Lashes Out Wildly

https://www.thebignewsletter.com/p/monopoly-round-up-states-to-challenge
2•chmaynard•9m ago•0 comments

Is the EU Becoming a Banana Republic with Chat Control?

https://mrkt30.com/is-the-eu-becoming-a-banana-republic-with-chat-control/
1•emsidisii•10m ago•0 comments

Why Reading Matters

https://calnewport.com/why-reading-matters/
1•ingve•12m ago•0 comments

Social media limits are coming for teens across Europe

https://www.theverge.com/tech/964565/eu-children-social-media-online-safety-rules
1•vrganj•12m ago•0 comments

Show HN: UATC-Closed-loop VRAM control and dynamic data pruning for LLM training

https://github.com/sajjaddoda72-design/UATC
1•L_u_u_6•14m ago•0 comments

Billionaire exodus? California drew 10x more venture capital than any state

https://finance.yahoo.com/technology/ai/articles/billionaire-exodus-california-drew-10-100000589....
3•smurda•15m ago•0 comments

Loam – AI hiring for early-stage founders

https://www.hireloam.com/
1•benhartley•15m ago•0 comments

Anthropic Moved the Fable Deadline Again

https://www.vincentschmalbach.com/fable-july-19-extension/
2•vincent_s•19m ago•0 comments

An Epistemic Audit for Existential Risks from AI

https://www.lesswrong.com/posts/aHJ8MkPTWPDnuFLRL/an-epistemic-audit-for-existential-risks-from-ai
1•joozio•19m ago•0 comments

White House to rally utilities, data centers over AI power costs

https://www.reuters.com/legal/litigation/white-house-rally-utilities-data-centers-over-ai-power-c...
1•adithyaharish•20m ago•0 comments

DiscoMCP – Turn an unknown MCP into a reusable operational skill for AI agents

https://github.com/ieranama/discomcp
1•inigoerana•22m ago•0 comments

Saws, Sewing Machines and Telescopes: Things on Loan from Your Library

https://www.kqed.org/news/12085382/saws-sewing-machines-and-telescopes-the-surprising-things-on-l...
3•agnosticmantis•22m ago•0 comments

Show HN: Sixfold – A quick to play word game

https://sixfold.pwheslop.com
1•pwheslop•24m ago•0 comments

Your Data built the AI boom – but Big Tech is pocketing 100% of the equity

https://www.marketwatch.com/story/your-share-of-the-ai-wealth-is-a-right-not-a-handout-here-is-ho...
2•robtherobber•28m ago•0 comments

Firefox will soon start releasing new versions every two weeks

https://www.neowin.net/news/mozilla-firefox-to-follow-google-chrome-microsoft-edge-with-new-relea...
3•bundie•30m ago•0 comments

Show HN: All the Government's 385,000 pages of UFO files to date

https://hypergrid.systems/war.gov-ufo-viewer/microfilm5
2•keepamovin•32m ago•1 comments

I built an iOS app that photographs your pantry and tells you what you can cook

https://apps.apple.com/us/app/simmerz/id6767691610
1•khhuff06•32m ago•0 comments