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: Hazzel, a minimal terminal coding agent with undo and BYOK

https://github.com/mukundzha/hazzel
1•mukundjha1•32s ago•0 comments

Muslim Prayer Reminder MCP: Astronomical prayer calculation engine

https://github.com/tareq7/muslim-prayer-mcp
1•najetareqz•2m ago•0 comments

SimFarm (1993) for the web, with mobile support

https://simfarm.petekim.xyz/
1•raingrove•2m ago•0 comments

US Federal budget deficit hits $2T in 2026 as national debt costs surge

https://www.foxbusiness.com/politics/federal-budget-deficit-hits-2t-national-debt-costs-surge
1•throw0101c•3m ago•0 comments

Tweet

https://tweet.app/
1•jervant•4m ago•0 comments

Runway Orientation Design – Where the Winds Blow

https://ihavenapkinthoughts.substack.com/p/runway-orientation-design-where-the
1•viraj_shah•5m ago•0 comments

Doom in Brainfuck

https://highghlow.ru/doombf/
1•unknownghost•7m ago•1 comments

Hyperdrive: How we solved a rare Hyperdrive MySQL caching bug

https://blog.cloudflare.com/hyperdrive-mysql/
1•khalidkhair•8m ago•0 comments

Audiobooker – Online Audiobook Production Studio

https://audiobooker.org
2•bitvvip•10m ago•0 comments

Regulating tech companies like banks

https://crimede-coder.com/blogposts/2026/RegulateLikeBanks
3•apwheele•12m ago•0 comments

Show HN: Axiom, a general-purpose model for causal discovery

https://www.maxpagels.com/axiom
2•maxpagels•12m ago•0 comments

A closed loop against hardware that only corrects one way

https://solenroot.com/blog/build-log-1/one-way-loop-3
1•solenroot•13m ago•0 comments

You can't beat the market, but you can lose to it

https://shakeddown.substack.com/p/you-cant-beat-the-market-but-you
2•surprisetalk•13m ago•0 comments

Show HN: Baiku – learn any topic in 5-minute lessons, then prove it with a quiz

https://baiku.ai
2•jishangiras•13m ago•0 comments

Qualcomm's lengthy legal battle with Arm nets it $2 (not a typo) in damages

https://www.androidauthority.com/qualcomm-lawsuit-arm-2-usd-damages-3723616/
2•theanonymousone•13m ago•0 comments

Figma Specs

https://www.figma.com/blog/introducing-figma-specs/
2•nthypes•14m ago•3 comments

Collapsing Linear Prose into Explicit Proposition Trees

https://www.fluxlinks.com/blog/logical-compilation-collapsing-linear-prose-into-explicit-proposit...
1•ezrasu•15m ago•0 comments

The AI boom's next bottleneck is money, not chips

https://www.semafor.com/article/10/15/2026/the-ai-booms-next-bottleneck-is-money-not-chips
2•thm•16m ago•0 comments

Time is running out: .com prices go up on November 1

https://domainnamewire.com/2026/10/09/time-is-running-out-com-prices-go-up-on-november-1/
2•mroche•16m ago•0 comments

Jev 1.14.0 is still bluffing on hard questions

https://brussle.com/evals/calibration/
2•shaunathan•16m ago•0 comments

Stepfun Step 5 Preview on HuggingFace

https://huggingface.co/stepfun-ai/Step-5-Preview-BF16
1•theanonymousone•17m ago•0 comments

US floats unfreezing some Russian assets to restart Ukraine peace talks

https://app.ft.com/content/54353d3a-afed-4fec-985a-50f3dfb9be8e
2•vrganj•17m ago•0 comments

They war-gamed dimming the Sun. It went worse than you think

https://www.wired.com/story/they-war-gamed-dimming-the-sun-it-went-even-worse-than-you-think/
3•rbanffy•19m ago•0 comments

What AI's Mathematical Breakthroughs Mean for Specialised Models

https://libido-sciendi.com/deep-dives/general-specialised-models
1•willybraun•19m ago•0 comments

John Ternus Is Engineering a New Era for Apple

https://time.com/collection/best-inventions/2026/apple-iphone-duo/
1•thm•19m ago•0 comments

HN Trends – how the front page changed since 2007

https://www.adriankrebs.ch/hn-trends/
2•hubraumhugo•20m ago•0 comments

Show HN: Nexus – open-source local-first message routing for agents

https://github.com/egregore-io/egregore-nexus
1•earldennison•20m ago•0 comments

LittleJS – JavaScript Game Engine for 2D and 3D Games

https://littlejsengine.com/
2•eustoria•20m ago•0 comments

Microsoft Releases Microsoft Defender for the Linux Desktop

https://www.phoronix.com/news/Microsoft-Defender-For-Linux-D
2•theanonymousone•21m ago•0 comments

Why Full Disk Access Matters–and What Apple Should Fix

https://tidbits.com/2026/10/12/why-full-disk-access-matters-and-what-apple-should-fix/
1•eustoria•22m ago•0 comments