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

The $75M Opportunity: Consolidating Canada's Fragmented AI Spending

https://zeitgeistml.substack.com/p/the-75m-opportunity-consolidating
1•eh_tk•1m ago•0 comments

Analytical Chemistry 2.0

https://asdlib.org/onlineArticles/ecourseware/Text_Files.html
1•loughnane•1m ago•0 comments

Skypilot: Run, manage, and scale AI workloads on any AI infrastructure

https://github.com/skypilot-org/skypilot
1•ahamez•1m ago•0 comments

Shark 2.0 – a free, open-source poker solver in C++

https://github.com/24parida/shark-2.0
1•aparida31•2m ago•1 comments

Sometimes Never Compete on Price

https://longform.asmartbear.com/never-compete-on-price/
1•gk1•2m ago•0 comments

Rethinking Heating

https://www.youtube.com/watch?v=o8xcHmYlyX8
1•oliversisson•4m ago•1 comments

'We got lazy and complacent': abolishing the wealth tax changed Sweden

https://theconversation.com/we-got-lazy-and-complacent-swedish-pensioners-explain-how-abolishing-...
1•PaulHoule•4m ago•0 comments

Zendesk Alternative

http://zendeskalternative.com
1•gk1•5m ago•0 comments

'On This Day... 1776'

https://www.youtube.com/playlist?list=PLYOGLpQQfhNIzsiXxPLUMwhBEunGH9bem
1•bookofjoe•5m ago•1 comments

Show HN: Stripe-no-webhooks – Sync your Stripe data to your Postgres DB

https://github.com/pretzelai/stripe-no-webhooks
3•prasoonds•5m ago•0 comments

Looking for open-source Python package for AI stock analysis

1•Siddartha_19•6m ago•0 comments

The European Schuko socket bothers me

https://blog.jgc.org/2026/01/the-european-schuko-socket-bothers-me.html
1•pbrowne011•6m ago•0 comments

OTLO

https://www.futurefabric.co/blog/otlo/
2•surprisetalk•7m ago•0 comments

Expert Book Recommendations

https://fivebooks.com/
1•surprisetalk•7m ago•0 comments

Yawning has an unexpected influence on the fluid inside your brain

https://www.newscientist.com/article/2513692-yawning-has-an-unexpected-influence-on-the-fluid-ins...
1•MDWolinski•8m ago•0 comments

Scott Galloway Calls to Cancel OpenAI Subscriptions to Launch Consumer Strike [video]

https://www.youtube.com/shorts/7GfJBIAg420
1•ddxv•8m ago•1 comments

Book Review of Stewart Brand's Maintenance

https://www.symmetrybroken.com/maintenance-the-mattering-instinct-for-engineers/
1•riemannzeta•9m ago•0 comments

Book Review of Steven Pinker's When Everyone Knows That Everyone Knows

https://www.symmetrybroken.com/uncommon-knowledge/
1•riemannzeta•9m ago•0 comments

Google's 'Project Genie' Is Basically a Plagiarism Tool

https://www.nintendolife.com/news/2026/01/googles-project-genie-is-basically-a-huge-plagiarism-to...
1•begemotz•11m ago•1 comments

Show HN: Xmrcheckout – self-hosted, non-custodial Monero checkout

https://xmrcheckout.com
1•pigless72•11m ago•0 comments

Parallel evaluation in Nix rolling out to Determinate Nix users

https://hachyderm.io/@determinatesystems/115985028320981183
2•embedding-shape•11m ago•0 comments

Show HN: Nano Queries, a state of the art Query Builder

https://vitonsky.net/blog/2026/01/24/nano-queries/
1•vitonsky•12m ago•0 comments

Show HN: A causal safety release gate for AI systems

https://github.com/EM1805/causal-safety-and-alignment-engine
1•EM1805•12m ago•1 comments

Will Agents replace search teams?

https://www.youtube.com/watch?v=OGnW2Pu2uVE
1•softwaredoug•12m ago•0 comments

Ruby 4.0 is available in the Microsoft Store

https://rubyinstaller.org/2026/01/27/ruby-4.0-available-in-microsoft-store.html
1•Kerrick•13m ago•0 comments

Skills on Tessl: the package manager for agent skills

https://tessl.io/blog/skills-are-software-and-they-need-a-lifecycle-introducing-skills-on-tessl/
1•popey•13m ago•0 comments

History of the PT2399 Delay Chip (2025)

https://www.perfectcircuit.com/signal/pt2399-delay-chip
1•thomasjb•13m ago•0 comments

We interfaced single-threaded C++ with multi-threaded Rust

https://antithesis.com/blog/2026/rust_cpp/
1•todsacerdoti•14m ago•0 comments

In solidarity with victims of ICE violence

https://blog.ericyd.com/in-solidarity/
3•ericyd•15m ago•3 comments

Oral history of the 555 timer IC, with its inventor Hans Camenzind

https://semiconductormuseum.com/Transistors/LectureHall/Camenzind/Camenzind_Index.htm
2•jrmg•15m ago•0 comments