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?

Inside Meta’s Efforts to Prevent School Shootings

https://www.newyorker.com/news/the-lede/inside-metas-efforts-to-prevent-school-shootings
1•thm•5m ago•0 comments

Yeti, an MCP server that guides product design from requirements to Jira

https://github.com/macorifice/yeti
1•macorifice•12m ago•1 comments

Shigeru Miyamoto on Gen AI

https://www.ndw.jp/nintendo-interview-261023/
1•glimshe•13m ago•0 comments

OpenShell WebUI – a secure local web UI for OpenShell

https://github.com/shaharia-lab/openshell-webui
1•shahariaa•14m ago•0 comments

PSA: Do not use term "vibe coding"

2•Rabbit504030201•17m ago•1 comments

Amazon's Trainium Takes a Strike at the Training King

https://newsletter.semianalysis.com/p/amazons-trainium-takes-a-strike-at
3•admjs•20m ago•0 comments

Show HN: I built a gallery wall planner for two-sided physical art

https://duoarts.com/gallery-walls
2•redclamp•21m ago•0 comments

The Faux-Vintage Photo: Full Essay

https://thesocietypages.org/cyborgology/2011/05/14/the-faux-vintage-photo-full-essay-parts-i-ii-a...
1•jruohonen•22m ago•0 comments

PhysicsForums and the Dead Internet Theory (2025)

https://hallofdreams.org/posts/physicsforums/
2•bmacho•24m ago•0 comments

I wish restaurants would stop asking for my phone number

https://www.theatlantic.com/culture/2026/10/restaurant-phone-number-question/688926/
1•bookofjoe•25m ago•1 comments

Portable SIMD is in C++26, and you can try it now

https://wrocpp.github.io/posts/portable-simd/
1•Tomte•26m ago•0 comments

What's at Stake in Serbia's Election

https://rademeechtatic.substack.com/p/whats-at-stake-in-serbias-election
1•samizdis•28m ago•0 comments

Ask HN: Linux at work revoked due to MDM, how to fight?

1•aleda145•28m ago•2 comments

Created my first app petpal

https://play.google.com/store/apps/details?id=com.nexushybrids.petpal&hl=en_US
1•Mohtasim801•35m ago•0 comments

Draggy: A Windows desktop app for local and cloud AI chat and coding

https://github.com/Lucki74/draggy
1•lucki74•36m ago•0 comments

Show HN: AI text detector that never sees your text (runs 100% in-browser)

https://kouh.me/ai-text-detector
3•mrkn1•36m ago•1 comments

Is This Machine Playing?

https://machineplaying.org/
1•DeepLogin•37m ago•0 comments

Researchers Integrate Electronics with Human Cells

https://www.umass.edu/news/article/body-electric-umass-amherst-researchers-integrate-electronics-...
2•geox•39m ago•0 comments

At Aberfan I saw father's digging for their missing children

https://www.theguardian.com/commentisfree/2026/oct/24/aberfan-disaster-missing-children-deaths-jo...
2•jimnotgym•41m ago•0 comments

Show HN: MCP server that answers Steam launch questions with real counts

1•steammaho•43m ago•0 comments

AI-Assisted Paper on Z-Library Cites a TorrentFreak Article That Doesn't Exist

https://torrentfreak.com/ai-assisted-paper-on-z-library-cites-a-torrentfreak-article-that-doesnt-...
23•TangerineDream•46m ago•0 comments

Practical Compiler Construction – Nils M Holm

https://t3x.org/reload64/index.html
3•AlexeyBrin•48m ago•3 comments

Super Mario creator breaks down the problem with AI perfectly

https://www.polygon.com/super-mario-bros-shigeru-miyamoto-ai-order-culture-japan-award-nintendo/
2•plaguna•48m ago•0 comments

US executives quit $25B gas venture over claims of secret Russian control

https://www.ft.com/content/e9cfbfbb-e65a-4303-aebb-20d59319ef1b
1•locknitpicker•49m ago•1 comments

Compromised eMudhra Intermediate Certificates

https://blog.talosintelligence.com/compromised-intermediate-certificates/
1•jruohonen•53m ago•0 comments

Google Analytics Alternative

https://lomenanalytics.com/
1•_Gustav_•55m ago•0 comments

Node.js Vulnerability Blog

https://nodejs.org/en/blog/vulnerability
8•Brysonbw•56m ago•1 comments

LiteLLM supply chain attack hoovers up passwords and secrets

https://www.theregister.com/security/2026/10/21/litellm-supply-chain-attack-hoovers-up-passwords-...
4•jruohonen•58m ago•0 comments

Mdfind Guide: macOS Spotlight Search from Terminal

https://myunix.org/macos/macos-spotlight-terminal/
3•ankitg12•59m ago•1 comments

eMudhra Intermediate CA Certificates Compromised

https://unit42.paloaltonetworks.com/emudhra-certificate-compromise/
3•Brysonbw•59m ago•0 comments