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

Running the Stupid Cricut Software on Linux

https://arthur.pizza/2025/12/running-stupid-cricut-software-under-linux/
1•starkparker•9m ago•0 comments

Gold blasts past $5k to record high on safe-haven rush

https://www.reuters.com/business/finance/gold-rushes-record-high-above-5000oz-2026-01-25/
2•SilverElfin•11m ago•2 comments

Show HN: InsAIts V2 – Real-time monitoring for multi-agent AI communication

https://github.com/Nomadu27/InsAIts
1•MrSteaddy•17m ago•0 comments

Show HN: (29x faster)Rapidvalidators - Python's validators lib rewritten in Rust

https://github.com/vivekkalyanarangan30/rapidvalidators
2•vivekkalyanaran•20m ago•0 comments

Flying Toasters

https://www.bryanbraun.com/after-dark-css/all/flying-toasters.html
2•sadeshmukh•24m ago•1 comments

Cloudflare-level AI-LLM bot protection, but data is under your control

https://github.com/cocky-punch/fantasma_cero
2•cascada•24m ago•0 comments

Trump says US used secret weapon to disable Venezuelan equipment in Maduro raid

https://apnews.com/article/trump-venezuela-weapon-maduro-drug-strikes-c052fd24a350a04a458f501b4b5...
3•colinprince•28m ago•4 comments

The Politics of Struggling Americans

https://www.gojiberries.io/the-politics-of-struggling-americans/
2•neehao•30m ago•0 comments

A Poem That Behaves Like a Machine

https://medium.com/@darwingosal/a-poem-that-behaves-like-a-machine-737fce2791f4
2•CharlesW•31m ago•0 comments

Environmentalists worry Google behind bid to control Oregon town's water

https://www.sfgate.com/national-parks/article/mount-hood-water-google-21307223.php
5•voxadam•34m ago•0 comments

Gemini team, please add URL query parameter support (?q= or?prompt=)

1•hiddenest•41m ago•1 comments

A New Hardware Class of 2026

https://www.recordsofthought.com/signal-to-source
1•colinprince•42m ago•0 comments

The Atelier: Craft, Code, and the Coming Guild

https://jamesmunsch.com/words/2026-01-18-the-atelier--craft--code--and-the-coming-guild.html
1•b1n•42m ago•1 comments

Show HN: WhyThere – Compare cities side-by-side to decide where to move

https://whythere.life
1•daversa•43m ago•0 comments

We built an AI coding tool that stores nothing on our servers

https://shakespeare.diy
5•ravenbitcoin•46m ago•3 comments

Central Banks Hit Next Stage in Cross-Border Payment Project

https://www.pymnts.com/news/cross-border-commerce/cross-border-payments/2026/central-banks-hit-ne...
1•shorsher•50m ago•0 comments

NukeCast: If it happened today, where would the fallout go

https://nukecast.com/
1•todd_tracerlab•53m ago•1 comments

Loki Mode: Autonomous System for Claude, Codex and Gemini CLI

https://github.com/asklokesh/loki-mode
1•slogansand•54m ago•2 comments

Windows 11's Patch Tuesday nightmare: Microsoft says some PCs might not boot

https://www.windowscentral.com/microsoft/windows-11/windows-11s-botched-patch-tuesday-update-nigh...
3•speckx•1h ago•0 comments

It Was One Guy

https://dannyman.toldme.com/2026/01/26/it-was-one-guy/
3•saulpw•1h ago•0 comments

The pandemic's hidden toll: chronic conditions left undiagnosed

https://medicalxpress.com/news/2026-01-pandemic-hidden-toll-millions-chronic.html
2•WaitWaitWha•1h ago•1 comments

Japan Bond Crash Unleashes a $7T Risk for Global Markets

https://www.bloomberg.com/news/features/2026-01-25/japan-bond-market-crash-raises-alarm-for-globa...
2•zerosizedweasle•1h ago•0 comments

Advanced hotdog

https://doghot.app/
6•jdojsinfn•1h ago•0 comments

Tech CEOs attend Amazon-funded "Melania" screening at White House

https://www.hollywoodreporter.com/movies/movie-news/white-house-vip-melania-screening-mike-tyson-...
36•camillomiller•1h ago•17 comments

Preparing Investigators for Trauma Exposure in Digital Forensics

https://www.forensicfocus.com/podcast/preparing-investigators-for-trauma-exposure-in-digital-fore...
2•WaitWaitWha•1h ago•0 comments

ChatGPT Is Pulling Answers from Elon Musk's Grokipedia

https://techputs.com/chatgpt-pulling-answers-from-grokipedia/
2•voxadam•1h ago•0 comments

Werewolf Romance 101: quick trope map and what to watch for

2•XiayMu•1h ago•0 comments

Ted Chiang and What it is like to be an A.I

https://jonathantdneil.substack.com/p/ted-chiang-and-what-it-is-like-to
2•hkhn•1h ago•0 comments

Yarbo autonomous snow blower clearing driveway during storm

https://twitter.com/tommolog/status/2015450792065376656
2•ChrisArchitect•1h ago•0 comments

Compiled Node.js 18 from source on jailbroken iPhone to run Claude Code

1•BryanTheCynic•1h ago•0 comments