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: Dockside – I turned unused space around the macOS Dock into a workspace

https://hachipoo.com/dockside-app
1•prajwalshetty•2m ago•0 comments

The Neurobiology of Cognitive Fatigue and Its Influence on Effort-Based Choice

https://pmc.ncbi.nlm.nih.gov/articles/PMC11275777/
1•rglover•4m ago•0 comments

Rust: First safety-certified embedded system

https://www.sonair.com/journal/worlds-first-safety-certified-3d-ultrasonic-sensor
1•torotime•4m ago•0 comments

Aerosmena hybrid thermal airships (2022) [pdf]

https://lynceans.org/wp-content/uploads/2021/04/Aerosmena_hybrid-thermal-airships-converted.pdf
1•simonebrunozzi•10m ago•0 comments

Show HN: BlackStork – render cybersecurity reports directly from structured data

https://blackstork.io
1•Traut•11m ago•3 comments

Holes

https://xkcd.com/3266/large/
3•caminanteblanco•13m ago•0 comments

Show HN: Solace – A quiet, local AI companion for Android with long-term memory

https://play.google.com/store/apps/details?id=com.solace.bot&hl=en_US
1•redhotcookerr•13m ago•0 comments

PamStealer: Rust-based macOS infostealer that validates credentials through PAM

https://www.jamf.com/blog/pamstealer-macos-infostealer-applescript-rust/
2•sea-gold•14m ago•0 comments

Proton's crypto is not Transparent and not OPAQUE

https://schaerli.org/weblog/5-proton/
1•akyuu•14m ago•0 comments

The parents movement that banned cellphones has a new target

https://www.politico.com/news/2026/06/27/schools-classroom-screentime-pushback-00974778
1•1vuio0pswjnm7•14m ago•0 comments

WeatherHub Storm Tracking App

https://weatherhubapp.com/
1•FarlandDev•15m ago•0 comments

Show HN: Pull Claude Code transcripts into your Codex session, and vice versa

https://contextify.sh/
1•bredren•17m ago•0 comments

A Field Guide to Fable: Finding Your Unknowns

https://twitter.com/trq212/status/2073100352921215386
1•mfiguiere•19m ago•0 comments

We built the missing link in neurostimulation from brain

https://neuroloop.pieeg.com/
1•Christiangmer•19m ago•0 comments

I Wasn't Allowed Prompting ChatGPT During My Chalk Talk: This Is Discrimination

https://inpreparation.substack.com/p/opinion-i-was-not-allowed-to-type
4•theanonymousone•21m ago•1 comments

The hard part was never the model

https://jenniferjiangkells.substack.com/p/the-hard-part-was-never-the-model
1•jjiangkells•22m ago•0 comments

Matrix Multiplication on Blackwell

https://www.modular.com/blog/matrix-multiplication-on-nvidias-blackwell-part-1-introduction
1•skidrow•23m ago•0 comments

Engineering Artificial Supreme Idiocy (EASI

https://zenodo.org/records/21171253
1•lexicantomotoes•23m ago•0 comments

FlashAttention-4: Algorithm and Kernel Pipelining

https://research.colfax-intl.com/flashattention-4-algorithm-and-kernel-pipelining-co-design-for-a...
2•skidrow•24m ago•0 comments

Show HN: Vublox Agent Tools, MCP server for live football scores and players

https://github.com/Vublox/vublox-agent-tools
1•whoopidi•24m ago•0 comments

Libraries are some of favorite places to take kids–except for screens

https://www.stlmag.com/family/libraries-screens/
1•theanonymousone•27m ago•0 comments

Craig Mod built his own Good Reads

https://craigmod.com/roden/115/
1•natbennett•29m ago•1 comments

Show HN: Debian 13 to ISO and Back

https://github.com/AtmanActive/Refracta-on-Debian-13-with-KDE
2•atmanactive•30m ago•1 comments

Token prices collapsing, regulation rising, AI's pricing power looks fragile

https://www.latimes.com/business/story/2026-07-03/with-token-prices-collapsing-regulation-rising-...
3•1vuio0pswjnm7•31m ago•0 comments

The One-Person Company Fantasy

https://www.minid.net/2026/7/3/the-one-person-company-fantasy
2•meerita•31m ago•1 comments

Vibe Hardware with Arduino, ESP32 and RP2040

https://velxio.dev/about/
4•noahnathan25•31m ago•0 comments

Flora: A Diagram Library Built with (and for) AI

https://www.normallydistributed.dev/introducing-flora-a-diagram-library-built-with-and-for-ai/
1•jillcates•32m ago•0 comments

Show HN: Migo Games, now playable on web

https://migo.games/arcade
1•calflegal•32m ago•0 comments

Tests suggest Russian satellites can jam GPS on a continental scale

https://arstechnica.com/space/2026/06/tests-suggest-russian-satellites-can-jam-gps-on-a-continent...
2•kekqqq•33m ago•1 comments

The 'Wall' That Keeps Flesh-Eating Worms Out of America

https://www.theatlantic.com/science/archive/2020/05/flesh-eating-worms-disease-containment-americ...
2•skm•37m ago•1 comments