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?

Show HN: Local-first note taking web app powered by SQLite WASM – notem

https://notem.pages.dev/
1•hanhan22•38s ago•0 comments

Linux Storage 101: Drives, Partitions, and Mounts

https://labs.iximiuz.com/skill-paths/linux-storage-101
1•theanonymousone•1m ago•0 comments

Base-2 vs. base-e log-sum-exp mismatch silently corrupts attention in SGLang

https://twitter.com/advprop/status/2089046843690729620
1•apsys•5m ago•0 comments

Tell HN: Cloudflare silently injects its analytics when you switch nameservers

3•stagas•7m ago•0 comments

Show HN: Atlas.nvim – Review PRs Inside Neovim

https://github.com/emrearmagan/atlas.nvim
2•emrearmagan•7m ago•0 comments

Spectre on RISC-V Silicon [pdf]

https://lukasgerlach.me/publication/2026-speculative-execution-attacks-on-risc-v-silicon/riscv_sp...
1•Tomte•8m ago•0 comments

AppleWorks on the Apple II

https://stonetools.ghost.io/appleworks-apple2/
1•TMWNN•10m ago•0 comments

Why all AI content sounds the same (and how to fix it)

https://dreasays.substack.com/p/why-all-ai-content-sounds-exactly
1•dundalk03•14m ago•1 comments

Show HN: Flynt.js – 2.2kb, zero-build, CSP-safe reactivity library for MPAs

https://github.com/marsbos/flynt.js
1•bosmarcel•16m ago•0 comments

The Life and Death of Direct File

https://www.ischool.berkeley.edu/research/publications/2026/life-and-death-direct-file
1•ronbenton•18m ago•0 comments

Show HN: I built my 15-year-old game idea in a week with AI

3•ashitlerferad•21m ago•0 comments

Google's new watch tracks insulin resistance to flag diabetes risk

https://www.latimes.com/business/story/2026-08-13/googles-wearables-will-track-insulin-resistance...
2•brandonb•22m ago•0 comments

Quality by John Galsworthy

https://americanliterature.com/author/john-galsworthy/short-story/quality
1•lain98•22m ago•0 comments

Show HN: I built an open-source, local-first work journal for developers

https://github.com/Meridiona/meridian/
1•adithyaharish•24m ago•0 comments

Lenire – Tinnitus Treatment Using Bimodal Stimulation

https://www.lenire.com/
1•Obscurity4340•24m ago•0 comments

Microsoft.Testing.Platform Crash-Resilient TRX

https://medium.com/c-sharp-programming/microsoft-testing-platform-crash-resilient-trx-e62f7cb6e16d
1•sukhpinder0804•25m ago•0 comments

Sectorforth is a 16-bit x86 Forth that fits in a 512-byte boot sector

https://github.com/cesarblum/sectorforth
2•sigalor•27m ago•0 comments

Show HN: Shippin.io – Your SaaS product deserves to be discovered

https://shippin.io
1•jayeshpadhiar•28m ago•1 comments

Gulf of Mexico is a perfect programming language

https://github.com/TodePond/GulfOfMexico
1•xiaoyu2006•30m ago•0 comments

I'm Creating a Minimal Dark Software Factory

https://joeldare.com/creating-a-minimal-dark-factory
1•codazoda•31m ago•0 comments

Atmo.rsvp is a decentralized events calendar built on the AT Protocol

https://portal.eurosky.tech/apps/3moebodfjt2oq
2•doener•31m ago•0 comments

Affix-io/SDK-light – PQC ML-DSA-65 Signing for proofs

https://www.npmjs.com/package/@affix-io/sdk-light
1•affixio•34m ago•0 comments

Show HN: The wanderer – cozy weekend game with no objective

1•freakynit•35m ago•1 comments

Loveyourclanker.org - Patterns of Agent Interaction

https://loveyourclanker.org/
2•javascriptmick•36m ago•2 comments

AI Can Guess Your Location from Social Media Photos with 87% to 91% Accuracy

https://www.macobserver.com/news/ai-can-guess-your-location-from-social-media-photos-with-87-to-9...
3•01-_-•38m ago•0 comments

Madrid hospital creates first bone metamaterial prosthesis

https://www.euronews.com/health/2026/08/15/madrid-hospital-creates-first-bone-metamaterial-prosth...
3•01-_-•38m ago•0 comments

Rcarmo/bun-packrat: Single-file web archive: SQLite-backed, self-contained HTML

https://github.com/rcarmo/bun-packrat
1•rcarmo•39m ago•0 comments

The Moviemaking Exodus from Hollywood

https://www.politico.com/news/magazine/2026/08/16/hollywood-film-production-illinois-tax-credits-...
2•RickJWagner•40m ago•1 comments

Show HN: The Gateless Gate – Ancient Zen text as 50 procedural 3D scenes

https://killedbyapixel.github.io/GatelessGate/
1•KilledByAPixel•41m ago•0 comments

'Fakers' by Rory Cormac Review

https://www.historytoday.com/archive/review/fakers-rory-cormac-review
1•pepys•41m ago•0 comments