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?

YouTube Had a Bug – I Used ChatGPT to Investigate

https://blog.thezilber.com/3-youtube-had-a-bug-chatgpt-helped-me-to-investigate
1•theZilber•33s ago•0 comments

Casio 'CasioNaut' G-Shock GMC-2500 GAC-2500 Series: Price, Specs, Availability

https://www.wired.com/story/casio-g-shock-casionaut-looks-like-a-patek-philippe-classic/
2•joozio•49s ago•0 comments

Any Nix package, live in the browser

https://fzakaria.com/2026/09/04/any-nix-package-live-in-your-browser
3•domenkozar•1m ago•0 comments

Tinymongo

https://tinymongo.org/
2•schapman1974•2m ago•1 comments

GitHub Status – Disruption with Copilot Code Review

https://www.githubstatus.com/incidents/zw1hbx2yyhvr
1•kyisaiah47•3m ago•0 comments

Where Will RISC-V Be in 20 Years? Poll Results

https://thechipletter.substack.com/p/where-will-risc-v-be-in-20-years
1•rbanffy•3m ago•0 comments

Show HN: Layerz – Native App Designer

https://www.layerz.app/
1•jaeyoung_choi•5m ago•0 comments

Bitcoin mining data center condemned after leaking 3M gallons of water

https://www.tomshardware.com/tech-industry/data-centers/bitcoin-mining-data-center-condemned-afte...
3•rbanffy•5m ago•0 comments

How algorithms are making our environments bland

https://theconversation.com/how-algorithms-are-making-our-environments-bland-289917
1•geox•5m ago•0 comments

An off the self BYOA platform

1•theguysudo•6m ago•0 comments

The Man That Invented the Popup

https://galratner.substack.com/p/the-man-that-invented-the-popup
1•blartpaul•7m ago•0 comments

Washington Post says Piker used AI generated audio but admits it has no proof

https://twitter.com/washingtonpost/status/2096304873557877132
2•slowin•7m ago•0 comments

All of Claude's "Never Do This" in Fable 5.1 System Prompt

https://artifactbin.dev/@vivek/MLWEU6-claude-s-nevers
2•nuwandavek•8m ago•0 comments

Connecting Kubernetes dependencies to application telemetry

2•chipfixer•8m ago•0 comments

Big Brother is going to college: The federal plan to track students for life

https://www.washingtonexaminer.com/op-eds/4710733/college-transparency-act-student-privacy-risks/
3•iamnothere•10m ago•1 comments

Apex City – Build a city that works

https://apexcity.reallexi.io
1•m22386•11m ago•0 comments

FDA Recalls IV Fluids over Possible Fiberglass, Stainless Steel Contaminants

https://www.healthline.com/health-news/fda-recalls-iv-saline-fluids-fiberglass-stainless-steel-co...
4•speckx•12m ago•0 comments

The Association for Computational Heresy

https://sigbovik.org/
2•jerlendds•15m ago•1 comments

Apple and Atari Connections – By Paul Lefebvre – Goto 10

https://www.goto10retro.com/p/apple-and-atari-connections
2•rbanffy•19m ago•0 comments

Ask HN: (Why) Was the LLM breakthrough useful for images, audio, etc.?

1•rogerrogerr•19m ago•0 comments

Jelly Baby

https://jelly.scottsun.io
1•memalign•20m ago•0 comments

Guess the Song in 0.1 Seconds

https://playdaily.org/songless
5•Hemmaamlin•21m ago•1 comments

Sunday programmer emergency: production is down. (quiz)

https://textlog.cc/post/3267?hn
2•stagas•21m ago•0 comments

OpenAI: We monitor internal coding agents for misalignment

https://openai.com/index/how-we-monitor-internal-coding-agents-misalignment/
2•lukaspetersson•24m ago•0 comments

Big brother watch report reveals free speech is in "downward spiral" in the UK

https://bigbrotherwatch.org.uk/press-releases/campaigners-urge-burnham-to-review-uks-anti-free-sp...
3•DeepLogin•24m ago•1 comments

Feature complete, as long as you add more features

https://site.sebasmonia.com/posts/2026-09-06-feature-complete--as-long-as-you-add-more-features.html
1•meetpateltech•25m ago•0 comments

Show HN: Robot-duck soccer in the browser, powered by MuJoCo and learned walking

https://fpvsim.com/sim-duck
1•mosfets•26m ago•0 comments

.gitignore Generator by Codra

https://codra.run/free-tools/gitignore-generator
2•devarshishimpi•28m ago•0 comments

Homelab deployments: a tutorial made of prompts

https://tomjohnell.com/homelab-deployments-a-tutorial-made-of-prompts/
2•tjohnell•29m ago•0 comments

Ask HN: How to prepare for coding/system design interviews on a mobile phone

1•k_dev•31m ago•0 comments