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 most official water costs $120k a gallon

https://signoregalilei.com/2026/07/26/the-most-official-water-costs-120000-a-gallon/
1•srijan4•2m ago•0 comments

AI Workspace for Your PC

https://stuard.ai
1•Ifesol•6m ago•1 comments

Verisign Cooperative Agreement

https://www.ntia.gov/program/verisign-cooperative-agreement
1•themaxdavitt•7m ago•0 comments

Nvidia in Talks with OpenAI to Guarantee $250B Financing for Data Center

https://www.wsj.com/tech/ai/nvidia-in-talks-with-openai-to-guarantee-250-billion-financing-for-da...
3•taurath•15m ago•1 comments

Show HN: 3D music visualization on Apple Vision Pro

https://old.reddit.com/r/VisionPro/comments/1v5llv9/3d_music_visualization_on_apple_vision_pro/
1•linxy97•16m ago•0 comments

Show HN: Watch random code typed out on an MS-DOS IDE

https://hackerman.specr.net/
2•vunderba•19m ago•0 comments

Sand battery: Finland's answer to a renewable energy headache

https://www.cnbc.com/2026/07/25/finland-sand-battery-renewable-energy-storage.html
2•coderintherye•21m ago•0 comments

Why AI Doesn't Replace Software Architecture – It Makes It More Valuable

https://wilburhimself.github.io/blog/65-why-ai-doesnt-replace-software-architecture/
1•wilburhimself•21m ago•1 comments

Malicious sites use JavaScript to build malware in browser memory

https://www.bleepingcomputer.com/news/security/malicious-sites-use-javascript-to-build-malware-in...
1•justworks•21m ago•0 comments

Show HN: CarbonSheets – Host your own customizable cheatsheet portal In GitHub

https://carbonsheets.vercel.app/
2•elnoxvie•25m ago•0 comments

Physicists build a computer from 400 particles orbiting in liquid

https://www.tomshardware.com/tech-industry/physicists-build-a-computer-from-400-particles-orbitin...
2•sbulaev•31m ago•0 comments

Sticky notes on a storyboard became my savior productivity app

https://www.taskloco.com/
1•taskloco_nyc•31m ago•0 comments

The Optimization Theory of Everything

https://12gramsofcarbon.com/p/the-optimization-theory-of-everything
1•theahura•37m ago•1 comments

Show HN: Quintile – keyboard-only window grids for Mac

https://github.com/stefanopineda/quintile
1•stefanopineda•41m ago•0 comments

Foxconn drops VMware, adopts hyperconverged upstart Arcrfra

https://www.theregister.com/virtualization/2026/07/27/foxconn-drops-vmware-adopts-hyperconverged-...
1•NordStreamYacht•43m ago•0 comments

Show HN: ASL V6 – Open-source AST red-teaming engine for Python AI agents

https://github.com/sivaadityacoder/asl-v6
2•sivaaditya•47m ago•0 comments

Show HN: Injectable time and timers with custom Date types for TypeScript

https://github.com/jaenyf/time-provider
1•jaenyf•49m ago•0 comments

Multimodal foundation model for image and video understanding from Microsoft

https://huggingface.co/microsoft/Mage-VL
1•MehrdadKhnzd•49m ago•0 comments

Bullwhip Effect

https://en.wikipedia.org/wiki/Bullwhip_effect
3•vismit2000•49m ago•0 comments

It is empowering to hand off execution

https://www.charbzg.com/blog/ai-empowerment
1•charbz•52m ago•1 comments

Palette Vault – Color Palettes and Hex Codes

https://palettevault.github.io/
4•javatuts•54m ago•0 comments

Porffor: An ahead-of-time JavaScript-to-native/WASM compiler

https://porffor.dev/
2•goranmoomin•55m ago•0 comments

Newpipe Extractor in WASM

https://github.com/thegrims/newpipe-extractor-wasm
1•aidangrimshaw•59m ago•1 comments

Paywall-free News Aggregator

https://freepress.today/
1•niraj-agarwal•1h ago•1 comments

Show HN: a Rust, Wayland, Vulkan 3D CRT, screencast application, retroarch cores

https://github.com/andrewfader/crtulum
1•androsynth89•1h ago•0 comments

India cuts internet, then demands removal of bitchat's code

https://korben.info/en/india-cuts-internet-demands-removal-bitchat-code.html
4•sakumen•1h ago•2 comments

Improving Terminal Ergonomics

https://aiex7.github.io/blog/articles/improving-terminal-ergonomics/
1•harr01•1h ago•0 comments

Why Lean is faster than Rust

https://kim-em.github.io/blog/2026-7-24-why-lean-is-faster-than-rust/
1•replatformradar•1h ago•1 comments

Renaissance Man: imago ex machina

https://github.com/willswire/renaissance-man
1•willswire•1h ago•0 comments

Genvap – Turn a screen recording into a cinematic app showcase video

https://genvap.com/
1•equinnt•1h ago•1 comments