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

Monero Ecosystem

https://monero.eco/
1•Cider9986•31s ago•0 comments

Theseus: Reverse-engineered reconstruction of the original Xbox 5960 dashboard

https://github.com/MrMilenko/Theseus
1•LorenDB•48s ago•0 comments

New research on analyzing and predicting token consumption of coding agents

https://arxiv.org/abs/2604.22750
2•jiaxinpei•3m ago•1 comments

Sluggers.fyi: Moneyball and Mario Super Sluggers

https://www.sluggers.fyi/
1•gsdv•5m ago•1 comments

Show HN: Playground for the Spectre Programming Language

https://spectrelang.org/playground
1•pizza_man•7m ago•0 comments

Memory Safe Argon2 Implementation in Pure Swift 6

https://github.com/mimiclone/argon2-swift
1•mimiclone•17m ago•0 comments

I got tired of messy PTO spreadsheets, so I built a simple tool

https://myfreecalendar.app/
1•aliencillo•19m ago•0 comments

Three dead in suspected hantavirus outbreak on Atlantic cruise ship

https://www.bbc.co.uk/news/live/cjrzp08wx4vt
1•etiam•21m ago•0 comments

Compatibility Is a Feature

https://yusufaytas.com/compatibility-is-a-feature
7•riowashere•23m ago•0 comments

Breathtaking

https://aeon.co/essays/do-hold-your-breath-on-the-benefits-of-conscious-breathing
1•andsoitis•28m ago•0 comments

Street Fishing in the Canals of 'Little Venice' – Treviso, Italy

https://www.nytimes.com/2026/04/21/travel/treviso-italy-canal-fishing-little-venice-local-guide.html
1•bookofjoe•30m ago•1 comments

Reality Is a Shared Hallucination (1997)

http://reactor-core.org/reality-hallucination.html
1•downbad_•31m ago•2 comments

Show HN: VidMark – Frame.io-style timestamped comments for Google Drive

https://github.com/markksantos/VidMark
1•markksantos•36m ago•0 comments

Waveoverhangs – Steep overhangs without supports

https://waveoverhangs.com/
1•SpyCoder77•37m ago•0 comments

Jensen says Nvidia now has 'zero percent' market share in China

https://www.tomshardware.com/tech-industry/artificial-intelligence/jensen-says-nvidia-now-has-zer...
3•iamflimflam1•37m ago•1 comments

UAE Plans to Run 50% of Government on Agentic AI Within Two Years

https://www.mitsloanme.com/article/uae-plans-to-run-50-of-government-on-agentic-ai-within-two-years/
2•andsoitis•44m ago•0 comments

Icestream – enabling efficient streaming writes in Apache Iceberg

https://github.com/jordepic/Icestream
2•jordepic•45m ago•1 comments

Techm Studios

https://www.techmstudios.co.za
1•mtyide•45m ago•0 comments

Keeping HamClock Alive

https://hamclock.com/
1•Ariarule•47m ago•0 comments

I'm Fighting Two Wars

https://www.ft.com/content/95f501d0-1493-47b0-8ada-dc7c942036c9
1•merksittich•49m ago•1 comments

The Planet Is Dying but You've Got Work on Monday

https://collapse2050.substack.com/p/the-planet-is-dying-but-youve-got
1•vrganj•51m ago•0 comments

Milei Ends Argentina's Deficit After 123 Years – Global Finance Magazine

https://gfmag.com/economics-policy-regulation/argentina-milei-administration-eliminates-deficit/
6•bilsbie•51m ago•1 comments

Onion Futures Act

https://en.wikipedia.org/wiki/Onion_Futures_Act
3•xvirk•55m ago•0 comments

Ask HN: How do you show your free software projects to the world?

3•MaxwellJensen•58m ago•4 comments

AI for Teams: Team-in-the-Loop

https://jitera.com/blog/team-in-the-loop/
2•jitera•59m ago•0 comments

Training language models to be warm can reduce accuracy and increase sycophancy

https://www.nature.com/articles/s41586-026-10410-0
1•Anon84•1h ago•0 comments

Australian police officers can be tracked via taser and body-cam bluetooth

https://www.abc.net.au/news/2026-05-04/police-location-tracked-bluetooth-flaw-axon-tasers-bodycam...
3•satori99•1h ago•0 comments

How A.I. Is Transforming China's Entertainment Industry

https://www.nytimes.com/2026/05/03/world/asia/china-microdrama-ai-backlash.html
2•Markoff•1h ago•1 comments

Duralang – decorator makes every LangChain LLM/tool/MCP call a Temporal Activity

https://temporal.io/code-exchange/duralang-durable-stochastic-ai-agents-with-one-decorator
3•deepanshsaxena•1h ago•0 comments

Most Companies Aren't Anywhere Near Ready for AI

https://danielmiessler.com/blog/most-companies-arent-ready-for-ai
1•rmason•1h ago•1 comments