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?

The New STOC Rules for the AI Era

https://blog.computationalcomplexity.org/2026/09/the-new-stoc-rules-for-ai-era.html
1•pcfwik•42s ago•0 comments

Show HN: Turn Your Voice into Art

https://reotoi.vercel.app
1•edimaudo•2m ago•0 comments

Empirical results fine-tuning π0.5 on a real manufacturing task

https://dream-machines.eu/blog/pi05-fine-tuning
1•mplappert•5m ago•0 comments

IR (2022)

https://github.com/dstogov/ir
1•lhmiles•7m ago•0 comments

Meta and the new VR glasses? Will Apple respond?

2•lathoa•8m ago•0 comments

China's new travel rules unsettle tech giants and talent

https://www.dw.com/en/china-technology-artificial-intelligence-expertise-capital-travel-rules/a-7...
7•billybuckwheat•9m ago•1 comments

Hail is a multibillion-dollar problem – and could get worse

https://www.hcn.org/issues/58-10/hail-is-a-multibillion-dollar-problem-and-could-get-worse/
3•littlexsparkee•10m ago•0 comments

Vibe Coding Production Kit – a production workflow for AI coding agents

https://github.com/Moeeryani/Vibe-Coding-Production-Kit
3•Moeeryani•14m ago•0 comments

Show HN: PipeFitter – Quick, Browser-Based, Parametric Pipe Connectors

https://mankyd.github.io/pipefitter/
2•mankyd•14m ago•0 comments

Show HN: Free WCAG accessibility checker – no signup, results in ~2 minutes

https://www.wcagrepair.com/tools/accessibility-checker
1•xLFCx•15m ago•0 comments

AI Help for Biological or Chemical Weapons

https://www.science.org/content/blog-post/ai-help-biological-or-chemical-weapons
2•EA-3167•17m ago•0 comments

Show HN: Canary (YC) – Independent verification for AI code

https://www.runcanary.ai/
4•Visweshyc•18m ago•0 comments

Dampen camera motion and track the leftover, in WASM

https://residual.dog
1•jobsstevesux•20m ago•0 comments

International observers to investigate Swedish election fraud

https://www.tv4.se/artikel/37VDHaUBmbgXCIRAP1bR8f/internationell-valobservatoer-ska-foelja-upp-mi...
3•try-working•21m ago•0 comments

SkillOpt: Training Loop for Agent Skills

https://microsoft.github.io/SkillOpt/
3•DaveFr•21m ago•2 comments

Show HN: Kosh – Browser's native bookmark manager ui, done right

https://chromewebstore.google.com/detail/kosh-bookmark-manager/meldjdfnfgefeoegccphimkmgmeamcce
1•havu12•22m ago•0 comments

The Board Game of the Alpha Nerds (2014)

https://grantland.com/features/diplomacy-the-board-game-of-the-alpha-nerds/
7•neonate•23m ago•4 comments

How I changed teaching after AI managed to do all my homework assignments

https://thelastsoftwareengineer.substack.com/p/how-i-changed-teaching-after-ai-managed
3•azhenley•24m ago•0 comments

Show HN: A $25 DIY alternative to $159 AI voice recorders – BYOK or local

https://zephclick.com
4•shmlkv•25m ago•0 comments

Reddit mod ordered to pay Nintendo $4.5M in Switch piracy lawsuit

https://www.theverge.com/games/1000088/nintendo-switch-piracy-reddit-mod-lawsuit
5•MC995•27m ago•0 comments

Ask HN: Got any interesting tech incident to share?

2•skwasimin•31m ago•0 comments

Show HN: p2p.kiwi – Cross-Platform (macOS <-> Windows <-> Linux) P2P Screenshare

https://p2p.kiwi/
1•GorillaMoe•31m ago•0 comments

Security headers on 4,688 small-business websites: 49.7% met none of 7 criteria

https://rackcrunch.com/security-headers-2026
3•terrybyte•34m ago•0 comments

Devenv 2.4: Machines

https://devenv.sh/blog/2026/09/24/devenv-24-machines/
1•domenkozar•36m ago•0 comments

California Is Chasing Wealth That Has Feet

https://blog.landeconomics.org/p/california-is-chasing-wealth-that
4•idbnstra•42m ago•2 comments

ESP32: The Arduino Rivals That Changed the Game

https://www.petkovsky.sk/esp8266-esp32-the-arduino-rivals-that-changed-the-game/
1•ex-aws-dude•42m ago•0 comments

Zeal – Offline Documentation Browser

https://zealdocs.org/
3•smartmic•44m ago•0 comments

Oracle triggers 'force majeure' on data center project over power delays

https://www.reuters.com/business/oracle-cites-force-majeure-shield-itself-controversial-data-cent...
1•vrganj•44m ago•0 comments

Issue Graph

https://github.com/vercel-labs/issue-graph
1•handfuloflight•46m ago•0 comments

DDoS Attack Breaks Beloved Video Game Wiki After AI Bro Was Banned

https://kotaku.com/ddos-attack-breaks-beloved-video-game-wiki-after-ai-bro-was-banned-2000729335
4•MBCook•47m ago•0 comments