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?

2x, not 10x: coding with LLMs in 2026

https://obryant.dev/p/2x-not-10x/
1•tnisonoff•2m ago•0 comments

Yes, the Hong Kong of Old Is Over

https://www.project-syndicate.org/commentary/hong-kong-is-over-just-another-big-chinese-city-by-s...
1•ksec•7m ago•1 comments

Deep Brain Stimulation

https://en.wikipedia.org/wiki/Deep_brain_stimulation
1•soupspaces•7m ago•0 comments

Waymo's driverless cars involved in 68% fewer crashes, U.S. study finds

https://www.cbc.ca/news/world/waymo-driverless-car-safety-study-9.7282895
1•curmudgeon22•12m ago•0 comments

Who's making money from using/exploiting AI?

3•jonthepirate•17m ago•0 comments

Scanwheel is a drum style mechanical television you can build yourself

https://github.com/AncientJames/Scanwheel/
1•tobr•18m ago•0 comments

I timed 7,194 journeys to find London's most equidistant pub

https://equidistance.io/londons-most-equidistant-pub/
1•lambfruit•20m ago•0 comments

Introduction to Multiparty Computation Tutorials

https://docs.stoffelmpc.com/tutorials/overview
2•badcryptobitch•21m ago•0 comments

Silicon Valley Splits over Closing the Borders to Chinese A.I

https://www.nytimes.com/2026/07/25/technology/open-source-silicon-valley-china.html
1•sbulaev•22m ago•0 comments

Samsung wins $200B Broadcom AI chip partnership, boosting foundry push

https://www.reuters.com/business/autos-transportation/samsung-elec-wins-200-billion-broadcom-ai-c...
3•geox•26m ago•0 comments

RedisME: RDM tool for Java serialization in the world

https://www.hepengju.com/
1•hepengju•30m ago•0 comments

A Convergence of Health Crises Under Robert F. Kennedy Jr. Leadership

https://bluepressjournal.substack.com/p/us-faces-multipronged-public-health
2•WinstonWendell•34m ago•0 comments

FDA panel supports broadening access to peptides popular on the gray market

https://www.npr.org/2026/07/23/nx-s1-5903202/fda-peptides-restrictions
2•andsoitis•36m ago•0 comments

Real Linux for your smartphone: Ubuntu Touch release 24.04-2.0 and 24.04-1.4

https://ubports.com/blog/ubports-news-1/ubuntu-touch-24-04-2-0-and-24-04-1-4-release-4007
3•readyblue•37m ago•1 comments

Messy Jobs: The Work That AI Cannot Reach

https://messyjobs.ai/
1•rafaelc•38m ago•0 comments

The Silurian Hypothesis (2020)

https://www.theparisreview.org/blog/2020/01/23/the-silurian-hypothesis/
5•andsoitis•41m ago•1 comments

Wikiview: Graph-based browsing of Wikipedia images

https://wikiview.net
3•qifzer•44m ago•0 comments

Micron urges White House to reject Apple's blacklist memory plan

https://appleinsider.com/articles/26/07/25/micron-urges-white-house-to-reject-apples-blacklist-me...
4•walterbell•44m ago•1 comments

The AI Productivity Illusion

https://www.hardresetmedia.com/p/the-ai-productivity-illusion
3•quick_brown_fox•45m ago•0 comments

Your Best Work Leaves No Trace: Why We Reward the Fix and Replace the Prevention

https://chrhenning.com/blog/2026/we-reward-the-fix-not-the-prevention/
1•chrhenning•45m ago•0 comments

My web version of Mars MIPS, now have builtin C compiler

https://webmars.nfiles.top/
2•nenepbl•46m ago•1 comments

Stripe in talks to acquire OpenRouter in potential $10B deal, WSJ reports

https://finance.yahoo.com/technology/ai/articles/stripe-talks-acquire-openrouter-potential-215104...
7•nlpnerd•50m ago•3 comments

Reality Bites Elon Musk and His Tesla, SpaceX Believers

https://www.wsj.com/finance/stocks/reality-bites-elon-musk-and-his-tesla-spacex-believers-1b639591
5•1vuio0pswjnm7•51m ago•4 comments

Show HN: Collecte MTL – Montreal waste collection schedules (web and iOS)

https://collectemtl.ca/
2•scastiel•51m ago•0 comments

Show HN: T-Shirt Weather. See the multi-day forecast for any city on a world map

https://tshirtweather.fyi
1•lowkeyokay•52m ago•0 comments

Chinese Discoveries Thru History

https://en.wikipedia.org/wiki/List_of_Chinese_discoveries
1•zoom6628•52m ago•1 comments

Trump administration admits clean energy grants were canceled based on politics

https://www.clickondetroit.com/news/politics/2026/07/25/trump-administration-admits-grants-for-cl...
5•zzzeek•54m ago•0 comments

KFC delivery to Ukraine's front line

https://xcancel.com/antibot/captcha
1•tim333•55m ago•0 comments

A shell colon does nothing. Use it anyway.

https://refp.se/articles/your-shell-and-the-magic-colon
3•olexsmir•55m ago•1 comments

Harddrive Is Probably Full

https://www.marginalia.nu/log/a_139_hdd/
2•ilreb•56m ago•0 comments