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?

Go quirks: function closures capturing mutable references

https://rednafi.com/go/closure-mutable-refs/
1•Brajeshwar•34s ago•0 comments

Can you stop beans from making you gassy?

https://www.seriouseats.com/how-to-reduce-bean-gas-tested-11883862
1•jstrieb•2m ago•0 comments

Show HN: The Order of the Agents – Make Codex and Claude Create the Perfect PRD

https://github.com/btahir/agent-order
1•bilater•4m ago•0 comments

RFC: Oden: The Server-First, JavaScript-Esque Runtime

https://rfchub.com/phobos/rfc5-oden-the-server-first-javascript-esque-runtime
1•tlhunter•8m ago•0 comments

The U.K. Smoking Ban Is Illiberal

https://www.theatlantic.com/ideas/2026/04/case-against-uk-smoking-ban/686949/
1•JumpCrisscross•8m ago•0 comments

Building Semantic Version Control in Rust

https://therohansharma.com/semantic-version-control-rust
1•lukastyrychtr•9m ago•0 comments

Logs say success. The system says otherwise

https://blog.bridgexapi.io/why-your-logs-say-everything-worked-even-when-it-didnt
1•Bridgexapi•10m ago•1 comments

Show HN: Good AI Task – a tool for asking AI what it can and can't do

https://goodaitask.com
1•jmt710•11m ago•0 comments

Nicholas Carlini – Black-hat LLMs [video]

https://www.youtube.com/watch?v=1sd26pWhfmg
6•simonebrunozzi•15m ago•0 comments

Show HN: Useknockout open source background removal API 40× cheaper -remove.bg

https://github.com/useknockout/api
3•tlorents•15m ago•0 comments

Show HN: AI Visibility Monitor – Track if your site gets cited by GPT/Claude

https://github.com/WorkSmartAI-alt/ai-visibility-monitor
3•balance006•16m ago•0 comments

Check Cloudflare D1, R2, Workers usage – see remaining limits for today/month

https://dialtoneapp.com/cloudflare
3•fcpguru•18m ago•1 comments

LLM-Rosetta: Zero-Dep API Translator for OpenAI, Anthropic, Google and Streaming

https://github.com/Oaklight/llm-rosetta
2•Oaklight•22m ago•0 comments

Artifacts Are Alive (and Photographs Are Dead)

https://worksonmymachine.ai/p/artifacts-are-alive-and-photographs
3•Stwerner•24m ago•1 comments

Show HN: Mapping Sonnet's thinking process via flame charts

https://adamsohn.com/lambda-variance/
2•dataviz1000•25m ago•0 comments

You're about to feel the AI money squeeze

https://www.theverge.com/ai-artificial-intelligence/917380/ai-monetization-anthropic-openai-token...
4•negura•25m ago•1 comments

Adding a team was the wrong strategic decision

https://learnings.aleixmorgadas.dev/p/adding-a-team-was-the-wrong-strategic
2•milkglass•26m ago•0 comments

The Stanford Freshmen Who Want to Rule the World

https://www.theatlantic.com/ideas/2026/04/stanford-students-power/686920/
5•apparent•28m ago•1 comments

Zerodep: Performant single-file, zero-dep Python modules (protobuf, YAML, etc.)

https://github.com/Oaklight/zerodep
2•Oaklight•32m ago•0 comments

Self-Hosted AI Red Team Tools

https://aetherverseintel.gumroad.com/l/vpzqnk
2•valuria•36m ago•1 comments

Agentic AI Chip Design Built a Full RISC-V Core

https://spectrum.ieee.org/ai-chip-design
2•rbanffy•37m ago•0 comments

Microsoft Reportedly Looking at Rebasing Azure Linux on Fedora

https://www.phoronix.com/news/MS-Azure-Linux-Fedora-Based
3•rbanffy•38m ago•0 comments

With TPU 8, Google Makes GenAI Systems Better, Not Just Bigger

https://www.nextplatform.com/compute/2026/04/24/with-tpu-8-google-makes-genai-systems-much-better...
3•rbanffy•39m ago•0 comments

Revocation of X.509 Certificates

https://blog.apnic.net/2026/04/24/revocation-of-x-509-certificates/
2•jandeboevrie•39m ago•0 comments

Show HN: Auto lock your Mac via phone proximity (No Apple Watch)

4•dabbygabby•40m ago•2 comments

America's Geothermal Breakthrough Could Unlock a 150-Gigawatt Energy Revolution

https://oilprice.com/Alternative-Energy/Geothermal-Energy/Americas-Geothermal-Breakthrough-Could-...
7•sleepyguy•40m ago•0 comments

The Nintendo Switch Switch (2019)

https://blog.cynthia.re/post/nintendo-switch-ethernet-switch
2•birdculture•41m ago•0 comments

Show HN: A faster, drop-in replacement for Tailscale's DERP relay

https://hyper-derp.dev/blog/hyper-derp-announcement/
4•KRuskowski•42m ago•1 comments

Show HN: Phinite – The OS layer (eval, observe, govern, A2A native)

https://www.phinite.ai/
2•PhiniteAI•44m ago•0 comments

Show HN: Perfect Fit – A minimalist B&W timing puzzle

https://play.google.com/store/apps/details?id=com.FathaGames.PerfectFit&hl=en_US
2•mrfatha•45m ago•0 comments