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•7mo 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•7mo 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•7mo 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•7mo 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•7mo ago
Load test against a clone instead of a DB whose contents you care about?

Flock and Urban Surveillance

https://computer.rip/2025-12-26-Flock-and-Urban-Surveillance.html
1•macleginn•1m ago•0 comments

Claude on Rails

https://claudeonrails.dev/
1•handfuloflight•2m ago•0 comments

DHH is immortal, and costs $200M

https://danieltenner.com/dhh-is-immortal-and-costs-200-m/
1•avyfain•4m ago•0 comments

Insights from Paper: FoundationDB:A Distributed Unbundled Transactional KV Store

https://hemantkgupta.medium.com/insights-from-paper-foundationdb-a-distributed-unbundled-transact...
1•teleforce•8m ago•0 comments

Rediscovering an American court portraitist

https://www.nationalreview.com/magazine/2026/02/rediscovering-an-american-court-portraitist/
1•hhs•12m ago•0 comments

Shutting Down the Hoover Building

https://twitter.com/FBIDirectorKash/status/2004650061242789976
1•hbcondo714•12m ago•0 comments

US judge blocks detention of British social media campaigner

https://www.bbc.com/news/articles/c33mx6j5jrvo
3•rbanffy•23m ago•0 comments

Ukraine Is Winning the War at Sea

https://phillipspobrien.substack.com/p/weekend-update-164-ukraine-is-winning
2•JumpCrisscross•24m ago•0 comments

Does tax avoidance trickle down?

https://www.nber.org/papers/w34209
2•hhs•29m ago•0 comments

Show HN: I built opencode –> telegram notification plugin

https://github.com/Davasny/opencode-telegram-notification-plugin
3•davasny•31m ago•0 comments

Stress-induced sympathetic hyperactivation drives hair follicle necrosis

https://www.cell.com/cell/fulltext/S0092-8674(25)01247-4?_returnURL=https%3A%2F%2Flinkinghub.else...
1•PaulHoule•34m ago•0 comments

Notes about FoundationDB (2020)

https://pierrezemb.fr/posts/notes-about-foundationdb/
2•teleforce•35m ago•0 comments

Reminiscences of a Stock Operator (1923)

https://gutenberg.org/cache/epub/60979/pg60979-images.html
1•thomassmith65•37m ago•0 comments

Julia vs. NumPy performance: Strategy for For-loop?

1•northlondoner•38m ago•0 comments

With memory prices to rise another 45% in 2026, Lenovo may delay laptop launches

https://www.notebookcheck.net/With-memory-prices-expected-to-rise-another-45-in-2026-Lenovo-may-d...
3•akyuu•39m ago•0 comments

What Makes a Strategy Great

https://longform.asmartbear.com/great-strategy/
2•gmays•42m ago•1 comments

The Economics of Bicycles for the Mind

https://www.nber.org/papers/w34034
1•Rexxar•43m ago•0 comments

Show HN: Waycore – an open-source, offline-first modular field computer

10•DGrechko•47m ago•7 comments

MakerLinks – A free link-in-bio page for indie hackers and builders

https://www.makerlinks.page/
2•amamuwala•48m ago•1 comments

We Lost the Thread on the Data Lake

https://blog.matterbeam.com/we-lost-the-thread-on-the-data-lake/
2•mikepk•49m ago•1 comments

The Park Ranger Scenario (2025 manifesto)

https://legacybranch.substack.com/p/eat-drink-and-be-merry-for-tomorrow
2•legacybranch•50m ago•0 comments

Weight-loss jab prescriptions double as Scottish doctors tackle obesity

https://www.thetimes.com/uk/scotland/article/weight-loss-jab-prescriptions-double-as-doctors-tack...
1•bookofjoe•54m ago•1 comments

Collective Action Problem

https://en.wikipedia.org/wiki/Collective_action_problem
1•danielschreber•56m ago•0 comments

Turning images into structured signals for modern search

https://visualquerypro.com
1•kalirobot•58m ago•1 comments

<deleted>

1•_rtld_global_ro•1h ago•0 comments

RotMG Map Seeds

https://www.redblobgames.com/blog/2025-11-07-rotmg-seeds/
1•guiambros•1h ago•0 comments

Ask HN: How to go back to listening to MP3s?

2•muratsu•1h ago•3 comments

Race Toolkit

https://github.com/auracast-research/race-toolkit
2•sva_•1h ago•0 comments

Show HN: UpDown, Simple Website Uptime Checker

https://updown.fly.dev/
1•ejncman•1h ago•2 comments

Show HN: I Made a Tiny Stranger Things Game While Waiting for the Finale

https://www.strangerclicks.com
1•jeanmayer•1h ago•2 comments