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

Even Artemis II Astronauts Have Microsoft Outlook Problems

https://www.wired.com/story/artemis-ii-microsoft-outlook-problems/
1•Growtika•42s ago•0 comments

Meshllm – Pool compute to run powerful open models

https://docs.anarchai.org/#
1•bluequbit•2m ago•0 comments

A technical report on Composer 2

https://cursor.com/blog/composer-2-technical-report
1•preetamjinka•2m ago•0 comments

Good ideas do not need lots of lies in order to gain public acceptance

https://blog.danieldavies.com/2004/05/d-squared-digest-one-minute-mba.html
1•sedev•2m ago•0 comments

MAI Announces 3 New Foundational Models

https://techcrunch.com/2026/04/02/microsoft-takes-on-ai-rivals-with-three-new-foundational-models/
2•lemonish97•3m ago•0 comments

Show HN: Wick – censorship circumvention tech repurposed for AI web access

https://getwick.dev
1•adamfisk•3m ago•0 comments

Is Taste the One Thing A.I. Can't Replace?

https://www.nytimes.com/2026/03/22/style/ai-tools-taste.html
1•bookofjoe•4m ago•1 comments

Show HN: Tool to extract root cause from Spring Boot logs

https://github.com/sayfessyd/gh-actions-error-revealer
1•sayfessyd•4m ago•0 comments

OpenAI Acquires TBPN

https://openai.com/index/openai-acquires-tbpn/
4•surprisetalk•4m ago•0 comments

Commit Messages

https://agateau.com/2026/on-commit-messages/
1•agateau•5m ago•0 comments

Terminal Agents Suffice for Enterprise Automation

https://huggingface.co/papers/2604.00073
1•virtuosarmo•5m ago•1 comments

The "Macro Overloading" Idiom

https://quuxplusone.github.io/blog/2026/04/02/macro-overloading/
1•jandeboevrie•6m ago•0 comments

A woman who alerts the world when an asteroid could hit

https://www.theguardian.com/science/ng-interactive/2026/mar/30/asteroid-warning-earth-un-office-f...
1•gmays•6m ago•0 comments

Pam Bondi ousted as Attorney General

https://www.cnn.com/2026/04/02/politics/pam-bondi-role-trump
2•Cider9986•6m ago•0 comments

New Scam: The "VIN Report" Scam

http://livingstingy.blogspot.com/2026/04/new-scam-vin-report-scam.html
1•speckx•7m ago•0 comments

Germany's nuclear phase-out is costing factories, workers, and the climate

https://garryslist.org/posts/merz-called-it-a-mistake-then-he-called-it-irreversible
1•gitowiec•10m ago•0 comments

Claude Code users hitting usage limits 'way faster than expected'

https://www.bbc.com/news/articles/ce8l2q5yq51o
1•OccamsMirror•11m ago•0 comments

ChatGPT Available in CarPlay

https://twitter.com/openai/status/2039748699350532097
2•zora_goron•12m ago•0 comments

Ask HN: Brian Kernighan's "Q"?

1•remywang•13m ago•0 comments

Anthropic leak reveals Claude Code tracking user frustration

https://www.scientificamerican.com/article/anthropic-leak-reveals-claude-code-tracking-user-frust...
1•beardyw•14m ago•0 comments

Post-quantum crypto on a $5 ESP32-S3M-KEM-768 in 9.6ms, open source

https://github.com/aethyrai/esp32-awp-edge
1•the_hermetist•15m ago•0 comments

Show HN: Voice talk with AI, all in the browser, no backend

https://talk-with-ai.surge.sh/
1•stagas•15m ago•0 comments

The Enigma of Gertrude Stein

https://www.thenation.com/article/culture/gertrude-stein-afterlife-wade-review/
2•samclemens•16m ago•0 comments

Stack – Business PreFlight

https://simplifyingcalculation.com
1•simcal•16m ago•0 comments

Show HN: I tested 15 free AI models at building real software on a $25/year VPS

https://georgelarson.me/writing/2026-04-03-25-dollar-ai-lab/
2•j0rg3•17m ago•0 comments

Show HN: Hacker News CLI

https://github.com/voska/hn-cli
2•voska•19m ago•0 comments

Distributed locking is not about locks. It's about ordering

https://medium.com/@mateuszmilewczyk/distributed-locking-is-not-about-locks-its-about-ordering-9a...
1•mmilewczyk•20m ago•0 comments

Blackstone Squeezes Thoma Bravo and Its Ailing Software Company Medallia

https://www.bloomberg.com/news/articles/2026-04-02/blackstone-squeezes-thoma-bravo-and-its-ailing...
2•petethomas•22m ago•0 comments

The Last Stack

https://residualstream.app/blog/the-last-stack/
2•speckx•22m ago•0 comments

Know if AI will replace your job

2•aidefender•24m ago•0 comments