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?

A Visual Journey Through Async Rust

https://github.com/alexpusch/rust-magic-patterns/blob/master/visual-journey-through-async-rust/Re...
1•vinhnx•3m ago•0 comments

AGI Constitution 01~02

https://medium.com/@miho999lv/agi-constitution-5bc29c13445a
1•miho999lv•4m ago•0 comments

Humans Haven't Stopped Evolving

https://www.harvardmagazine.com/research/harvard-human-evolution-genes-selective-pressure
1•ilamont•4m ago•0 comments

Montana ETRB

https://twitter.com/NiklasAnzinger/status/2081081011123953832
1•Ariarule•5m ago•0 comments

Show HN: MutexCam – Global Camera and Mic Control on Mac for Zoom, Teams, Meet

https://mutex.cam/
1•superquizonline•6m ago•0 comments

Agentic test processes, LLM benchmarks, and other notes on agentic coding

https://danluu.com/ai-coding/
2•bathtub365•12m ago•0 comments

Open Source Repo

https://github.com/Ardrey-Kell-Computer-Science-Club/teenblogcs
3•shivcodes2•17m ago•0 comments

JetZero

https://www.jetzero.aero
16•lisper•18m ago•3 comments

India's 'Cockroach' Protesters Declare Rare Victory over Government

https://www.nytimes.com/2026/07/25/world/asia/india-education-minister-resigns-cockroach-protests...
3•thunderbong•22m ago•0 comments

We built the new fastest API for GLM-5.2

https://www.baseten.co/blog/how-we-built-the-new-fastest-api-for-glm-52/
2•philipkiely•22m ago•0 comments

Show HN: Raise a virtual pet with your friend/partner

https://dandan.schols.io
2•chaidhat•31m ago•0 comments

Google ignored my site for 13 weeks, so I audited everyone who outranks me

https://getqrcodepro.com/blog/google-ranking-evidence
2•benbuilds•38m ago•0 comments

An ESP32 based plane radar for my desk

https://blog.ktz.me/esp32-plane-radar/
8•alexktz•38m ago•1 comments

Lessons from Building My Own Products as a Freelance Engineer

https://www.mazin.sd/blog/lessons-from-building-my-own-products-as-a-freelance-engineer
2•maz225•40m ago•0 comments

Four Proposals to Improve Fuel Economy Standards (2021)

https://epic.uchicago.edu/area-of-focus/four-proposals-to-improve-fuel-economy-standards/
2•bariumbitmap•43m ago•0 comments

Show HN: Rules that stop AI coding agents from breaking working code

https://github.com/avenna01-ceo/claude-code-survival-kr
2•gaiinmaster•43m ago•0 comments

Show HN: I enhanced the UX for TemplatesOn, what do you think?

https://templateson.com
2•maz225•51m ago•0 comments

Multiple LLMs trying to reach a consensus

https://trekhleb.dev/blog/2026/yesbrainer/
2•trekhleb•52m ago•0 comments

Show HN: I mapped every US golf course – 16k+ courses, free, no signup

https://golfcoursebrowser.com/
7•rickmf•52m ago•0 comments

What Colorado consumers should know about the cyclospora outbreak

https://source.colostate.edu/cyclospora-outbreak-safety-symptoms/
4•mooreds•52m ago•0 comments

Ajay Kumar on running MCP in production [audio]

https://www.getreadyforagents.com/podcast/ajay-kumar-mcp-in-production-ediy/
2•mooreds•53m ago•0 comments

When You Build the Wrong Thing

https://remotesynthesis.com/posts/when-you-build-the-wrong-thing/
3•mooreds•55m ago•0 comments

Show HN: What 180k words look like as a temporal knowledge graph (Oz series)

https://synaptale.com/graph?ch=100
4•ald0r•56m ago•0 comments

Do People Swallow 8 Spiders a Year While They Sleep? (2014)

https://www.scientificamerican.com/article/fact-or-fiction-people-swallow-8-spiders-a-year-while-...
3•thunderbong•58m ago•0 comments

How Many Bits Can an Adapter Write? Capacity and Memorization of LoRA

https://arxiv.org/abs/2607.21351
2•sbulaev•1h ago•0 comments

Dartmouth Workshop on Artificial Intelligence (1956)

https://en.wikipedia.org/wiki/Dartmouth_workshop
2•d_silin•1h ago•0 comments

1209X Agentic Engineering

https://twitter.com/psdimov/status/2081179527884034259
3•pdcd•1h ago•0 comments

Sally the Robot Was Coming to a New York School. Then the Plug Was Pulled

https://www.nytimes.com/2026/07/25/nyregion/robot-school-new-york-salamanca.html
3•apparent•1h ago•2 comments

Show HN: Fitter – declarative web-data extraction,running in the browser also

https://pxyup.github.io/fitter/
4•pyxru•1h ago•2 comments

NYU Stern pricing expert: The hidden 'AI tax' hitting your next phone

https://fortune.com/2026/07/24/apple-ai-memory-chip-price-increases/
4•1vuio0pswjnm7•1h ago•1 comments