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

Claude Code Now Hides the Way It Works-But There's a Workaround

https://www.i-programmer.info/news/105-artificial-intelligence/18709-claude-code-now-hides-the-wa...
1•aquastorm•13s ago•0 comments

How AI is being used in war – and what's next

https://www.nature.com/articles/d41586-026-00710-w
1•geox•58s ago•0 comments

The iPod Classic Cheatsheet: A guide to our iPod world

http://www.yuuiko.space/iPodGuide/
1•luispa•1m ago•0 comments

Modernizing swapping: virtual swap spaces

https://lwn.net/Articles/1059201/
1•voxadam•1m ago•0 comments

Show HN: Cruxible Core – Deterministic decision engine with receipts for agents

https://github.com/cruxible-ai/cruxible-core
1•rmalone1097•2m ago•0 comments

Ask HN: Pricing model for internal OpenClaw agents others now ask to buy?

1•liaai0630•2m ago•0 comments

I regained control over the code my AI writes for me

https://archtocode.com
1•grzelazny•3m ago•1 comments

Show HN: LLM Price to Performance Tool

1•StratusBen•3m ago•0 comments

My coding agent built Figma from scratch

https://twitter.com/itsandrewgao/status/2029624157181497743
2•agtestdvn•4m ago•0 comments

What went wrong before anyone noticed

https://callitearly.substack.com/p/what-went-wrong-before-anyone-noticed
1•NickDouglas•5m ago•0 comments

Remotely unlocking an encrypted hard disk

https://jyn.dev/remotely-unlocking-an-encrypted-hard-disk/
1•janandonly•5m ago•0 comments

OpenAI's Codex is "now" on Windows

https://thenewstack.io/openais-codex-is-now-on-windows/
1•theanonymousone•6m ago•0 comments

GPT 5.4 is Launching

https://twitter.com/sama/status/2029622732594499630
2•jbegley•7m ago•0 comments

Wgsl-rs: Rust as a shader language

https://renderling.xyz/articles/introducing-wgsl-rs.html
1•fanf2•7m ago•0 comments

A Dream to Make an ERP System Come True Inside a Medical Device Facility

https://www.paxerp.com/blog/pax-origins
1•robeym•8m ago•1 comments

Docs Considered Harmful

https://tornikeo.com/docs-considered-harmful/
1•tornikeo•8m ago•0 comments

IntelliJ IDEA: The Documentary – An origin story [video]

https://www.youtube.com/watch?v=Kourq_Lz03U
1•blufish•9m ago•1 comments

Yet another job scheduler bug

https://iafisher.com/notes/2026/03/scheduler-bug
1•todsacerdoti•10m ago•0 comments

GPT-5.4 Thinking System Card

https://deploymentsafety.openai.com/gpt-5-4-thinking
1•vinhnx•10m ago•0 comments

Accepting user-supplied code is mostly fine

https://dimden.dev/blog/?id=15-webtiles-its-fine-to-accept-user-supplied-code-actually
2•birdculture•10m ago•0 comments

Built my first ever open-source project: Decision Guardian

1•poor_husteler•11m ago•0 comments

Show HN: Nexus Gateway – Reduce LLM API Costs Using Semantic Caching

https://www.nexus-gateway.org/
1•Sunnyanand_dev•11m ago•0 comments

Show HN: Aimux – tmux for AI coding agents

https://github.com/zanetworker/aimux
1•zanetworker•12m ago•0 comments

Show HN: GovernsAI – unified auth, memory, and PII guard across AI providers

https://www.governsai.com/
1•shaivpidadi•14m ago•0 comments

Telemetry helps. you still get to turn it off

https://ritter.vg/blog-telemetry.html
2•todsacerdoti•15m ago•0 comments

Moon Reactors (2026)

https://nmof.app.box.com/s/dhk54nhfonwr2g3jgbwubj5s4ip4rroy
2•joebig•16m ago•0 comments

Show HN: Pypistats – Real-time PyPI trends, AI insights and badges

https://pypistats.com
1•diverdale•16m ago•1 comments

Gorilla in the Node.js Ecosystem

https://thoughtzip.substack.com/p/the-gorilla-in-the-nodejs-ecosystem
1•deostroll•17m ago•0 comments

Ageless Linux: A Debian-based distro that is illegal to distribute in California

https://goblincorps.com/ageless-linux.html
2•vicethal•17m ago•1 comments

The A.I. disruption we've been waiting for has arrived

https://www.nytimes.com/2026/02/18/opinion/ai-software.html
3•pramodbiligiri•17m ago•0 comments