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?

The Lasting Influence of John Berger

https://www.newyorker.com/magazine/2026/11/16/john-berger-a-life-tom-overton-book-review
1•prismatic•9m ago•0 comments

Foreign Comiket attendees locked out as Ticketpay geoblocks non-Japanese IPs

https://twitter.com/kotorisenseiba/status/2120374093493248166
1•phantomathkg•10m ago•0 comments

Show HN: Rusty Valve – Chemical plant valve benchmark where ACT scores 0/36

https://github.com/rusty-valve/rusty-valve
1•CrystalDai•14m ago•0 comments

NRC Issues First Construction Permit in Nearly 60 Years for Gas-Cooled Reactor

https://www.nrc.gov/about-nrc/news-releases/2026/26-083
1•geox•16m ago•0 comments

The Forever-Day Problem: Unsupported Software on the Public Internet

https://blog.fortirix.com/blog/forever-day/
1•SecurityNinjaGu•20m ago•0 comments

Ring Robotics

https://ring.com/ring-robotics
2•gregsadetsky•22m ago•0 comments

Show HN: App to help parents find, plan, and review outings with their kids

https://sproutings.app/
1•brendanperry•22m ago•0 comments

Data Centers and Local Labor Markets: Evidence from the Texas Experience

https://jrap.scholasticahq.com/article/172680-data-centers-and-local-labor-markets-evidence-from-...
1•toomuchtodo•23m ago•1 comments

Richard Posner, influential and iconoclastic federal judge, dies at 87

https://www.washingtonpost.com/obituaries/2026/11/11/richard-posner-influential-iconoclastic-fede...
3•pseudolus•26m ago•2 comments

When LIMIT 10 Means 500

https://vito.io/articles/2026-10-25-when-limit-10-means-500
1•ykgoon•31m ago•0 comments

Bad ideas that aren't bad anymore

https://devonestes.com/bad-ideas-that-arent-bad-anymore
1•sevenseacat•35m ago•0 comments

Show HN: Eyes-free spoken N-Back where you choose the words (single HTML file)

https://vernetit.github.io/spoken-n-back/
1•quietcircuit•39m ago•1 comments

Neurons as an Interpretable Basis

https://www.goodfire.com/research/neurons-as-an-interpretable-basis
1•gmays•39m ago•0 comments

Some Memories of Early Anthropic

https://www.lesswrong.com/posts/9PiLfo6iQbbDWFHv7/some-memories-of-early-anthropic
2•wslh•41m ago•0 comments

The Myth of "Neutral Code"

https://foss.life/notes/2026/the-myth-of-neutral-code/
3•tachalorah•43m ago•0 comments

Fortell DSP Pipeline

https://fortell-demo-hoeksema.vercel.app/
1•hoeksema•46m ago•0 comments

Show HN: Paper Radar – daily ArXiv triage, now runs on Claude Haiku too

https://github.com/Eliot5566/JEV-Paper-Radar
1•eliot5566•47m ago•0 comments

Show HN: Four Seasons in Real Time

https://vivaldirt.stream/
1•supernihil•1h ago•0 comments

Show HN: Ramasite, a Self-Contained Laravel/Filament/SQLite CMS

https://github.com/DaleFranks/ramasite
1•DaleFranks•1h ago•1 comments

Show HN: VpsPilot, Manage a Linux VPS from Android, with undo for config changes

https://vpspilot.app/
1•sadawy•1h ago•0 comments

Upcoming meeting could determine if US loses its measles elimination status

https://abcnews.com/Health/upcoming-meeting-determine-us-loses-measles-elimination-status/story?i...
1•gmays•1h ago•0 comments

A look at what building with the Web Models API looks like in JavaScript

https://medium.com/@kenzic/web-models-api-practical-guide-ba23773962a5
1•kenzic•1h ago•0 comments

Show HN: OpenSwells – free, open-source surf forecasts for 5,800 spots

https://openswells.com/
1•etc1212•1h ago•2 comments

Why Do Astra and Opus 5.5 Fail Simple 2D Mazes?

https://www.fig.inc/blog/multinet-v2-preview-astra-opus/
1•pranavguru•1h ago•0 comments

Can't Be Pumped. Can't Be Dumped. Can't Predict It. Can't Manipulate It

https://tokenmobiles.live
2•elykcim•1h ago•0 comments

Lean Grimoire

https://terrytao.wordpress.com/2026/11/11/lean-grimoire/
10•smilelamp•1h ago•1 comments

Social Proof

https://en.wikipedia.org/wiki/Social_proof
2•o4c•1h ago•0 comments

Compromised GitHub accounts push CI secret stealer to 61k repositories

https://www.aikido.dev/blog/compromised-github-accounts-push-ci-secret-stealer-to-tens-of-thousan...
2•acossta•1h ago•0 comments

Lessons from 59 Linux Kernel Bug Reports

https://forge-blog.github.io/posts/linux-kernel-3-month-lookback/
1•tsgates•1h ago•0 comments

Memory safety bugs in Rust std/core

https://forge-blog.github.io/posts/rust-std-memory-safety/
2•tsgates•1h ago•0 comments