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?

Opus 4.7 Became Better at Web Design

https://www.yashthapliyal.com/blog/opus-4-7-web-design
1•yash1hi•1m ago•0 comments

Write broken commits for better review

https://huonw.github.io/blog/2026/04/broken-commits/
1•dbaupp•2m ago•0 comments

Ask HN: How did you get your first users with zero audience?

1•arikusi•4m ago•0 comments

I built send/links to stop losing links across tabs, bookmarks, and chats

https://sendlinks.app
1•prashantchanne•4m ago•0 comments

Characterizing the Impact of Congestion in Modern HPC Interconnects

https://arxiv.org/abs/2604.11432
1•matt_d•5m ago•0 comments

Stop Using JWTs

https://gist.github.com/samsch/0d1f3d3b4745d778f78b230cf6061452
1•birdculture•6m ago•0 comments

Shipfast.py – SaaS Starter Kit for Python Devs (FastAPI and Supabase and Stripe)

https://www.shipfastpy.com/
1•brandocalricia•7m ago•1 comments

The Long Hunt for China's Vanishing Elephant Slides

https://www.sixthtone.com/news/1018428
1•sohkamyung•8m ago•0 comments

Aliens.gov Resolves – To a WordPress "Site Not Found" Error

4•ascarola•10m ago•2 comments

Mechanics' institute

https://en.wikipedia.org/wiki/Mechanics%27_institute
1•hhs•10m ago•0 comments

Accessing Hardware in Rust

https://ferrous-systems.com/blog/hardware-access-rust/
1•PaulHoule•11m ago•0 comments

Rewiring financial services to scale intelligence

https://www.valtech.com/blog/rewiring-financial-services-to-scale-intelligence/
1•mooreds•12m ago•0 comments

Anubis weighs the soul of incoming HTTP requests to stop AI crawlers

https://github.com/TecharoHQ/anubis
2•rzk•12m ago•0 comments

Show HN: Rebuilt SETI Home but for AI

https://github.com/Agent-FM/agentfm-core
3•s4saif•13m ago•2 comments

Tessera: Unlocking Heterogeneous GPUs Through Kernel-Granularity Disaggregation

https://arxiv.org/abs/2604.10180
1•matt_d•17m ago•0 comments

Natural Selection Shaped Humanity

https://www.economist.com/science-and-technology/2026/04/15/how-natural-selection-really-shaped-h...
2•andsoitis•18m ago•0 comments

Big Tech's $300M election war chest rattles Democrats

https://www.ft.com/content/7529e4cd-e336-4b75-917b-84f91bc48437
1•petethomas•19m ago•0 comments

I Invented Lattice and Isomorphic Computing

https://github.com/aevov/afolabi-unified-framework
1•wakanda-island•21m ago•1 comments

Show HN: NoFS – What if files are just projections, graph is the truth?

https://nofs.ai/
1•mmethodz•25m ago•0 comments

Casus Belli Engineering

https://marcosmagueta.com/blog/casus-belli-engineering/
1•schonfinkel•33m ago•0 comments

Closure of Radio 4 on Long Wave (LW)

https://www.bbc.co.uk/reception/work-warning/news/radio4lw
2•austinallegro•34m ago•1 comments

Grpo explained: group relative policy optimization for LLM finetuning

https://cgft.io/learn/grpo-intro/
1•kumama•35m ago•0 comments

U.S. to Create High-Tech Manufacturing Zone in Philippines

https://www.wsj.com/world/asia/u-s-to-create-high-tech-manufacturing-zone-in-philippines-017c1668
12•dcgudeman•36m ago•7 comments

15% of Reddit Posts are Likely AI-generated in 2025

https://originality.ai/blog/ai-reddit-posts-study
3•akyuu•37m ago•2 comments

Street Fighter 2026 Trailer

https://www.youtube.com/watch?v=gX0Btbbddxk
3•havblue•40m ago•1 comments

Reed Hastings is leaving Netflix after 29 years

https://www.engadget.com/entertainment/streaming/reed-hastings-is-leaving-netflix-after-29-years-...
2•andsoitis•40m ago•0 comments

Helpful translations from British English (2015)

https://www.independent.co.uk/news/uk/home-news/chart-shows-what-british-people-say-what-they-rea...
1•worik•40m ago•1 comments

Unicorn Market Cap 2026: SF Is the GenAI Super Cluster

https://blog.eladgil.com/p/unicorn-market-cap-2026-sf-is-the
1•gmays•43m ago•0 comments

Ollama v0.21.0-Rc0

https://github.com/ollama/ollama/releases/tag/v0.21.0-rc0
1•maxloh•43m ago•0 comments

Release PiClaw v1.8.0 – This Is Spinal Tap

https://github.com/rcarmo/piclaw/releases/tag/v1.8.0
2•rcarmo•44m ago•0 comments