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•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?

AI Tools Are Only as Good as Your Judgment – and That's the Point

https://theaileverageweekly.com/posts/your-ai-tools-are-only-as-good-as-your-judgment-and-that-s-...
2•talvardi7•1m ago•0 comments

Diary of a Disabled DJ

https://medium.com/@samhenrycliff/diary-of-a-disabled-dj-entry-1-81f55f8c23bf
1•6stringmerc•1m ago•0 comments

Ask HN: Are recent tech layoffs affecting mostly Sr and Jr devs?

2•bubbamack•4m ago•0 comments

Ask HN: What is your tips or wild usages on gcloud?

1•revv00•5m ago•0 comments

The OSS Sabotage Manual Became Corporate Best Practice

https://www.alephic.com/sabotage
1•cyb0rg0•6m ago•1 comments

ALPR Mission Creep: School Residency, Background Checks, and Noise Complaints

https://www.eff.org/deeplinks/2026/05/more-license-plate-reader-mission-creep-school-residency-ve...
2•hn_acker•10m ago•1 comments

Show HN: Artifold – A local-first library for AI-generated HTML artifacts

https://github.com/shubhamgoel27/artifold
1•shubhamgoel27•12m ago•0 comments

Anthropic Appoints KiYoung Choi as Representative Director of Korea

https://www.anthropic.com/news/kiyoung-choi-representative-director-anthropic-korea
1•surprisetalk•16m ago•0 comments

CodeAtlas – Google Maps for your codebase, with a live differential UML engine

https://www.codeatlas.live/
2•vamsikanneganti•21m ago•0 comments

Ecosystem for (Studying) Network Programming

https://docs.packetcord.io/
1•vmetodiev•24m ago•0 comments

Cloudflare Flagship

https://developers.cloudflare.com/flagship/
3•tjek•25m ago•1 comments

Unit cell designer for 2d wallpaper groups

https://nasqret.github.io/symm/
1•mathgenius•26m ago•0 comments

The true reason C++ always wins [video]

https://www.youtube.com/watch?v=I7fEsbksKRE
1•abhaynayar•27m ago•0 comments

You're about to feel the AI money squeeze

https://www.theverge.com/ai-artificial-intelligence/917380/ai-monetization-anthropic-openai-token...
1•1vuio0pswjnm7•31m ago•0 comments

Qualcomm strikes AI chip deal with TikTok owner ByteDance

https://www.reuters.com/business/qualcomm-strikes-ai-chip-deal-with-tiktok-owner-bytedance-bloomb...
2•Voblit•35m ago•0 comments

Grok Build

https://grok.com/build
2•kristianpaul•40m ago•0 comments

Show HN: I made a simple Keyword Research tool for app devs

https://ezscreenshots.com/aso/
1•abrowniejr•41m ago•0 comments

I Made a Journal for AI-Generated Papers

https://cesarhidalgo.com/blog/2026/5/26/why-i-made-a-journal-for-ai-generated-papers
2•Anon84•42m ago•0 comments

Iran's access to global internet starts to resume after 88-day blackout

https://www.theguardian.com/world/2026/may/26/iran-internet-blackout
4•theali•43m ago•1 comments

A Luxury Survivalist Community Is Tearing Itself Apart

https://www.wsj.com/us-news/a-luxury-survivalist-community-is-tearing-itself-apart-53d2a99f
8•impish9208•43m ago•1 comments

NASA Provides Update on Moon Base Rovers, Landers, Missions

https://www.nasa.gov/news-release/nasa-provides-update-on-moon-base-rovers-landers-missions/
2•Anon84•44m ago•0 comments

Starlink and Amazon may be able to buy into EU mobile satellite spectrum plan

https://www.reuters.com/business/aerospace-defense/european-companies-set-receive-two-thirds-futu...
1•Voblit•45m ago•0 comments

Where are those goalposts? I'm sure I put them here somewhere

https://nickdrozd.github.io/2026/05/26/goalposts-math.html
1•nickdrozd•47m ago•0 comments

The AI Token plumbing issue

https://getlago.com/blog/ai-billing-is-mostly-token-plumbing
1•jdenquin•47m ago•0 comments

Magnifica Humanitas, LaTeX Version

https://github.com/cucho/magnifica-humanitas/blob/master/latex/en.tex
1•cucho•50m ago•0 comments

MySQL faithful launch OurSQL Foundation to keep Oracle honest

https://www.theregister.com/databases/2026/05/26/mysql-faithful-launch-oursql-foundation-to-keep-...
3•thejerz•53m ago•0 comments

Supreme Court rejects Meta's appeal in Vermont social media addiction case

https://apnews.com/article/meta-teens-harms-supreme-court-6a0de777da59575ca0210b275892835a
3•1vuio0pswjnm7•56m ago•0 comments

The AI Bubble

https://nooneshappy.com/article/the-ai-bubble/
3•SupremumLimit•56m ago•0 comments

Xiaomi MiMo-v2.5 price drops 99% – AI pricing war

https://platform.xiaomimimo.com/docs/en-US/welcome
5•mariopt•58m ago•3 comments

Altman and Amodei both walking back on AI jobs apocalypse prophecies before IPOs

https://fortune.com/2026/05/26/sam-altman-dario-amodei-walking-back-ai-jobs-apocalypse-prophecies...
4•1vuio0pswjnm7•1h ago•0 comments