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

Some first thoughts about live immersive basketball

https://sixcolors.com/post/2026/01/some-first-thoughts-about-live-immersive-basketball/
1•coloneltcb•6m ago•0 comments

Where's the $100k iPhone?

https://boydkane.com/essays/100k-iphone
1•zdw•11m ago•0 comments

MIT Non-AI License

1•dumindunuwan•12m ago•1 comments

Show HN: Understand the Picture of the Day

https://picture.learntosolveit.com
1•orsenthil•12m ago•0 comments

Haraltd – A cross-platform Bluetooth daemon with a JSON-based RPC

https://github.com/bluetuith-org/haraltd
1•darkhz•13m ago•0 comments

The Stick in the Stream

https://randsinrepose.com/archives/the-stick-in-the-stream/
1•zdw•15m ago•0 comments

MAKERphone 2: first modular DIY phone, no soldering

https://circuitmess.com/products/makerphone-2-0
1•nateb2022•15m ago•0 comments

Sodium-ion battery cells near lithium-ion cost parity, set to get cheaper

https://www.ess-news.com/2026/01/09/sodium-ion-battery-cells-already-near-lithium-ion-cost-parity...
1•toomuchtodo•15m ago•1 comments

OpenAI to Buy Pinterest? Strategic Analysis

https://nekuda.substack.com/p/openai-to-buy-pinterest-heres-what
1•gmays•17m ago•0 comments

Vajra BM25 is a fast BM25 implementation in Python

https://twitter.com/aiexplorations/status/2009846407881212136
1•aiexplorations•20m ago•1 comments

Show HN: A website to save moments that remind you of someone

https://thisremindedme.com/
1•Winggo•20m ago•0 comments

Google and chatbot startup Character move to settle teen suicide lawsuits

https://www.washingtonpost.com/technology/2026/01/07/google-character-settle-lawsuits-suicide/
1•1vuio0pswjnm7•23m ago•0 comments

Agent skills: what can go wrong?

https://github.com/pors/skill-audit
1•pors•23m ago•0 comments

You probably don't need Oh My Zsh

https://rushter.com/blog/zsh-shell/
11•fla•24m ago•3 comments

Fix Your Robots.txt or Your Site Disappears from Google

https://www.alanwsmith.com/en/37/wa/jz/s1/
2•qingcharles•25m ago•1 comments

Show HN: VoiceBrainDump – voice-first idea capture, single HTML file, offline

https://voicebraindump.app/
1•digi_wares•28m ago•0 comments

Show HN: Focus timer that turns hours into assets

https://seton.run/
1•keplerjst•33m ago•0 comments

Kazakhstan Launches First Institute of Transport Sciences and Technologies

https://qazinform.com/news/kazakhstan-launches-first-institute-of-transport-sciences-and-technolo...
1•Bolat14•37m ago•0 comments

AI Flatters with Fidelity

https://lucent.substack.com/p/ai-flatters-with-fidelity
2•surprisetalk•38m ago•0 comments

Lidify: Self-hosted, on-demand audio streaming platform like Spotify

https://github.com/Chevron7Locked/lidify
1•thunderbong•41m ago•0 comments

Show HN: Rank up your local business on Google Maps

https://www.mapclimb.com/
3•bagusfarisa•41m ago•0 comments

The world has too much oil – Will companies want Venezuela's?

https://www.npr.org/2026/01/07/nx-s1-5668491/venezuela-oil-global-markets
4•geox•47m ago•0 comments

Elon Musk's Grok Has Friends in High Places: US Patent Office chief AI officer

https://jacobin.com/2026/01/grok-hayes-artificial-intelligence-deepfakes
2•wahnfrieden•48m ago•0 comments

Checks and Balances Are Dead

https://rall.com/2026/01/08/checks-and-balances-are-dead
6•SanjayMehta•49m ago•0 comments

M2.1: Multilingual and Multi-Task Coding with Strong Generalization

https://www.minimaxi.com/news/m21-multilingual-and-multi-task-coding-with-strong-general
1•gmays•51m ago•0 comments

Character.ai and Google agree to settle lawsuits over teen suicides

https://www.ft.com/content/ac518567-d901-4fae-86a3-eab54b12a81d
1•1vuio0pswjnm7•1h ago•0 comments

Demystifying Evals for AI Agents

https://www.anthropic.com/engineering/demystifying-evals-for-ai-agents
1•vinhnx•1h ago•0 comments

Best Practices for Coding with Agents

https://cursor.com/blog/agent-best-practices
1•vinhnx•1h ago•1 comments

Microsoft revealed as company behind controversial data center proposal in MI

https://www.cnbc.com/2026/01/07/microsoft-behind-controversial-data-center-in-michigan-township.html
4•1vuio0pswjnm7•1h ago•0 comments

A man powers his home for 8 years using 1,000 recycled laptop batteries

https://scienceclock.com/a-man-powers-his-home-for-8-years-using-1000-recycled-laptop-batteries/
3•ashishgupta2209•1h ago•1 comments