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?

'Smart' underwear that counts your farts

https://www.independent.co.uk/news/science/fart-tracker-underwear-b2919610.html
2•prakharjohari•17s ago•0 comments

Solving Ancient Ciphers with Claude

https://dbourdeau.github.io/cyphersolver/index.html
1•Dbourdeau•38s ago•1 comments

WipEout 3: Special Edition at 100 FPS [video]

https://www.youtube.com/watch?v=c8vjP2bmAZM
1•msephton•49s ago•1 comments

Wikivibes – Write the truth you wished existed

https://wikivibes.org/
1•tcfhvgyjb•1m ago•0 comments

I have to bury my talent in yesterday

https://docs.google.com/document/d/1OhhuBRXUetyVDWU5fYT3yHeuWKuBnba8g14ay2xTRmg/view?tab=t.0
1•zxh•1m ago•0 comments

Israeli Minister Threatens Filmmakers' Citizenship over Gaza Documentary

https://www.reutersconnect.com/item/israeli-minister-threatens-filmmakers-citizenship-over-gaza-d...
1•Markoff•1m ago•1 comments

From Templates to Reflection, Part 1: Back to the Basics with Type_vector

https://daniel-petrovic.github.io/blog/type-vector-operating-on-types/
1•signa11•3m ago•0 comments

Visa overstayers: Americans top list with 925 cases in three years

https://www.nzherald.co.nz/nz/more-than-900-americans-have-overstayed-their-visa-in-last-three-ye...
1•kartik147•4m ago•0 comments

Show HN: Vaultis, an offline password vault that makes zero network connections

https://apps.apple.com/us/app/vaultis-offline-vault/id6810739786?mt=12
1•KoreDEV•6m ago•0 comments

Affine Space Types

http://videocortex.io/2018/Affine-Space-Types/
1•signa11•6m ago•0 comments

A Cop Searched 19,000 Flock Cameras Across 1,558 Cities. His Reason: 'LMAO'

https://www.techtimes.co.uk/police-flock-search-licence-plate-lmao-1808683
2•Tiwariparth6165•6m ago•1 comments

Is the AI Apocalypse for Real?

https://www.kenklippenstein.com/p/is-the-ai-apocalypse-for-real
1•jwf123•8m ago•0 comments

We Benchmark Analytics Agents, this explains how

https://benchouse.ai/blog/how-we-benchmark-analytics-agents
1•andrebaaij•8m ago•1 comments

Online Z3 Guide

https://microsoft.github.io/z3guide/
1•Bluestein•8m ago•0 comments

Show HN: Trains.fyi – Global Train Tracker

https://trains.fyi/
1•ryderdamen•9m ago•0 comments

Closing the IPv6 First-Packet Gap with Grand

https://labs.ripe.net/author/pouria/closing-the-ipv6-first-packet-gap-with-grand/
1•m_montazeri•9m ago•0 comments

Show HN: Duff's device, sleep sort and a quine, hung in a room you walk through

https://www.programmingmuseum.com/hall/curiosities
1•justbits•9m ago•0 comments

Show HN: Remoc – Rust RPC where channels are first-class values

https://remoc.rs/
1•surban•9m ago•0 comments

GM gives its most important trucks a new UI–and includes CarPlay

https://arstechnica.com/cars/2026/09/gm-gives-its-most-important-trucks-a-new-ui-and-includes-car...
1•mixdup•9m ago•1 comments

Show HN: Epistemic Physics: Bayesian Special Relativity

https://raia.fun/blog/ep-001-bayesian-special-relativity
1•viamiraia•9m ago•0 comments

Show HN: RelateAnything – Real-time open-vocabulary relation prediction

https://github.com/Maelic/RelateAnything/
1•maelicn•10m ago•0 comments

An open source alternative to Raycast, in Rust

https://github.com/MystikoLab/rustcast
1•luispa•10m ago•0 comments

MiSeGuard – Deterministic runtime safety layer for AI coding agents

https://github.com/midhunweb/miseguard
1•misetech•10m ago•0 comments

Mathematics Enters Its Cookie Clicker Era

https://www.reinvent.science/p/mathematics-enters-its-cookie-clicker
1•danrecht•11m ago•0 comments

Stabilizing Rust's Never Type

https://lwn.net/SubscriberLink/1091015/5009546caa744c57/
1•fanf2•11m ago•0 comments

China mulls building nuclear-powered tank with 450km-range railgun in 2 decades

https://www.scmp.com/news/china/science/article/3367546/china-mulls-building-nuclear-powered-tank...
1•bookofjoe•12m ago•1 comments

Into the CUDA Multiverse of Runtime Compilation: GPU DBMS Kernel Fusion [pdf]

https://www.vldb.org/pvldb/vol19/p4658-schule.pdf
1•matt_d•13m ago•0 comments

The CSS Zen Garden dream shipped

https://josprague.com/blog/the-css-zen-garden-dream-finally-shipped/
2•yosito•13m ago•1 comments

What we have learned at OpenShell applying formal methods to control AI agents

https://nvidia.github.io/OpenShell-Research/dev-notes/posts/2026-09-10-learning-formal-methods-ag...
2•alexwatson405•13m ago•0 comments

Anyon Computing Unveils Real-Time Quantum Control System Built on Nvidia NVQLink

https://www.hpcwire.com/off-the-wire/anyon-computing-unveils-real-time-quantum-control-system-bui...
1•rbanffy•14m ago•0 comments