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?

You're probably using Agent Skills wrong

https://notes.ansonbiggs.com/youre-probably-using-agent-skills-wrong/
1•MisterBiggs•30s ago•0 comments

Hacking their bodies for a longer life: is there science behind their methods?

https://www.nature.com/articles/d41586-026-01884-z
1•olalonde•3m ago•0 comments

World-first catch: new shark species

https://www.eurekalert.org/news-releases/1132305
1•gmays•8m ago•0 comments

Show HN: Baserates.dev, memorize programmer napkin math

https://www.baserates.dev/
1•stopachka•11m ago•0 comments

The Doom Justifies the Valuation

https://geohot.github.io//blog/jekyll/update/2026/06/21/the-doom-justifies-the-valuation.html
5•inatreecrown2•17m ago•0 comments

The Next Black President

https://www.vanityfair.com/story/the-next-black-president
5•Kapura•20m ago•0 comments

Ask HN: Are you being "529 Overloaded" by Anthropic too?

3•hmokiguess•21m ago•1 comments

QEMU with Espressif

https://github.com/espressif/qemu
2•arbayi•22m ago•0 comments

Older iPhones are vulnerable to a flaw Apple likely can't fix

https://mashable.com/tech/older-iphones-vulnerable-to-a-flaw-apple-cant-fix
2•gnabgib•23m ago•0 comments

Claude: Elevated Error Rates for Opus 4.8, Opus 4.7, Opus 4.6, and Sonnet 4.6

https://status.claude.com/incidents/lv35v0q9nsj2
28•forks•23m ago•28 comments

(Reverse Engineering) Apple Internals: Swift in the Kernel

https://blog.calif.io/p/apple-internals-swift-in-the-kernel
3•dnw•26m ago•0 comments

1983 Northern Telecom Commodore Phone

https://www.oldtelephoneroom.ca/1983-northern-telecom-commodore-phone/
3•arexxbifs•28m ago•0 comments

Give your sandboxed agents API keys they can't read

https://www.superserve.ai/blog/introducing-secrets/
2•Amit_Patil_010•30m ago•0 comments

Better Grammar – Grammar Practice for Adults

https://benkaiser.github.io/better-grammar/
2•benkaiser•34m ago•0 comments

Summer Solstice 2026: Sunrise Live from Stonehenge [video]

https://www.youtube.com/watch?v=Z8a4eoxUIMw
2•zeristor•34m ago•2 comments

10 years of terms and conditions I've agreed to

https://henryach.com/blog/tsandcs/
3•henryhoward•37m ago•1 comments

An Axiomatic Audit of Modern Physics Frameworks via Structural Logic

https://zenodo.org/records/20780519
2•VCNoninski•39m ago•0 comments

Promptblock – detect prompt injections in GitHub issues

https://ryandens.github.io/promptblock/
2•rdens1•42m ago•1 comments

Show HN: I Built an MCP Server in 200 Lines of Go (and Claude Became 10x Useful)

https://medium.com/dev-genius/i-built-an-mcp-server-in-200-lines-of-go-and-claude-became-10x-more...
2•cheikhshift•43m ago•1 comments

Show HN: Wirewright, an experimental symbolic physics environment

https://github.com/wirewright/wirewright
2•homonoidian•47m ago•0 comments

HiFi/Stereo Review-Stereo Review – Audiophile Magazine from 1958 to 1999

https://www.worldradiohistory.com/Archive-All-Audio/HiFI-Stereo-Review.htm
3•PopAlongKid•54m ago•1 comments

Show HN: Phileas – Local-first memory that remembers you

https://github.com/alexajuno/phileas
2•alexajuno•55m ago•1 comments

Jets were 300 feet apart in Boston close call that forced Delta flight to abort

https://www.pbs.org/newshour/nation/jets-were-300-feet-apart-in-boston-close-call-that-forced-del...
4•abixb•56m ago•0 comments

New Super Pac Aims to Rally Tech Workers to Help Limit A.I

https://www.nytimes.com/2026/06/18/technology/ai-super-pac-guardrails-alliance.html
12•reasonableklout•57m ago•0 comments

Napoleon Was a Guitarist

https://www.yamaha.com/en/musical_instrument_guide/classical_guitar/trivia/
4•thunderbong•1h ago•1 comments

Bean – a portable convergence gate for agent work

https://github.com/grainulation/bean/
4•woptober•1h ago•0 comments

Spas Were a Mistake (2022)

https://gomakethings.com/articles/spas-were-a-mistake/
4•kristianp•1h ago•1 comments

FoodFavs

https://foodfavs-euq7bgdf.manus.space/
2•pteridactlecdt•1h ago•0 comments

Show HN: TaxLens – free lodging-tax API for hotels, OTAs, and property managers

https://taxlens.getdynamiq.ai
2•vitalii-duk•1h ago•0 comments

A dead simple personal website engine for developers focused on simplicity

https://github.com/iam-mhaseeb/koji
4•iamhaseeb•1h ago•0 comments