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•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?

The Pkg.go.dev API

https://go.dev/blog/pkgsite-api
1•0xedb•47s ago•0 comments

HN Polisher Demo

1•j_zhan•5m ago•0 comments

NTSB pulls docket after AI recreates dead pilots' voices

https://arstechnica.com/ai/2026/05/ai-users-re-create-dead-pilots-voices-from-crash-investigation...
2•Lihh27•5m ago•0 comments

OpenAI intentionally removed Codex's visible context usage indicator

https://github.com/openai/codex/issues/23794
1•gobdovan•7m ago•1 comments

The Surprising Divide over What Counts as True

https://reason.com/2026/05/15/the-surprising-divide-over-what-counts-as-true/
1•rendx•8m ago•0 comments

DeepSeek-V4-Pro 75% off discount is now permanent

https://twitter.com/deepseek_ai/status/2057854261699195173
1•yogthos•9m ago•0 comments

JuliaMono – a monospaced font for scientific and technical computing

https://juliamono.netlify.app/
1•michaelsbradley•10m ago•0 comments

Is this what driving an F1 car feels like?

https://cameronwestland.com/is-this-what-driving-an-f1-car-feels-like/
1•camwest•10m ago•0 comments

Beautiful Monero Block Explorer, mempool.space copycat

https://monerospace.org
1•Cider9986•17m ago•0 comments

Hengefinder: Finding When the Sun Aligns with Your Street

https://victoriaritvo.com/blog/hengefinder/
1•evakhoury•18m ago•0 comments

I'm writing again (Cringely)

https://www.cringely.com/2026/05/21/im-writing-again/
2•dxs•19m ago•1 comments

Linux LPE via GRO managed-frag UAF (io_uring SEND_ZC and veth)

https://gist.github.com/lcfr-eth/2566a5cef312c94a5ff8d62fa417955f
2•Tiberium•20m ago•0 comments

No child deaths definitively linked to Covid shots, FDA says

https://www.nbcnews.com/health/health-news/no-child-deaths-definitively-linked-covid-shots-fda-sa...
7•ceejayoz•22m ago•0 comments

AI-native-founder-playbook-skills

https://github.com/Hades-HY-LI/ai-native-founder-playbook-skills
1•hades_sixy•25m ago•1 comments

AI is minting new billionaires, and workers want their share

https://restofworld.org/2026/samsung-south-korea-union-ai-profits/
6•billybuckwheat•26m ago•0 comments

you_can::turn_off_the_borrow_checker

https://docs.rs/you-can/latest/you_can/attr.turn_off_the_borrow_checker.html
2•striking•27m ago•0 comments

Private Credit Pricing: Are Prosecutors Opening Up Pandora's Box?

https://www.morningstar.com/alternative-investments/private-credit-pricing-are-prosecutors-openin...
2•petethomas•27m ago•0 comments

How Your Brain Decides What Matters

https://nautil.us/how-your-brain-decides-what-matters-1281159
3•devonnull•27m ago•0 comments

Show HN: Coder Words – An offline-first PWA word puzzle for programmers

https://7coderwords.kenamick.com/
2•p2detar•28m ago•0 comments

AI keeps inventing fake cases. Lawyers keep citing them

https://www.scientificamerican.com/article/why-lawyers-keep-citing-fake-cases-invented-by-ai/
6•voxadam•31m ago•0 comments

Models.dev: open-source database of AI model specs, pricing, and capabilities

https://github.com/anomalyco/models.dev
12•maxloh•32m ago•1 comments

Kommodo.ai Covered by Indiehackers

https://www.indiehackers.com/post/tech/pivoting-to-reach-a-wider-audience-and-hitting-a-5-figure-...
1•KommodoAI•34m ago•2 comments

Show HN: Datapoint AI – Make Something People Want, but Ask Them First

https://trydatapoint.com
3•yoloakki•34m ago•2 comments

China: What I Learned from the AI Labs, Robotics Startups and Academia

https://matthewdwhite.substack.com/p/eight-days-in-china-what-i-learned
3•rmason•35m ago•0 comments

Show HN: Slophunt.ai – Come post your vibe coded projects

https://slophunt.ai/
1•0x10ca1h0st•35m ago•1 comments

Show HN: Go Deep into Code

https://codeep.dev/
1•VladoIvankovic•35m ago•0 comments

PowerDNS Authoritative and LMDB and Lightning Stream / SLAC2026 / German [pdf]

https://www.heinlein-support.de/sites/default/files/media/documents/2026-05/SLAC2026_Authoritativ...
1•_bernd•37m ago•0 comments

DHS: Immigrants have to go back for Consular Processing

https://xcancel.com/DHSgov/status/2057817233200418837
3•dzonga•37m ago•0 comments

Show HN: OpenRig – a control plane for multi-agent coding topologies

https://www.openrig.dev/
1•mschwarz•39m ago•1 comments

LimeWire re-emerges in rush to share pulled 60 Minutes segment

https://arstechnica.com/tech-policy/2025/12/yo-what-limewire-re-emerges-in-online-rush-to-share-p...
3•rickcarlino•40m ago•1 comments