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?

Through Captain Jean-Luc Picard, Patrick Stewart taught us the measure of a man

https://www.bostonglobe.com/2026/10/29/metro/patrick-stewart-picard-star-trek-the-next-generation/
1•apress•42s ago•0 comments

Reddit is going logged-in only. Blame Google AI Overviews

https://www.businessinsider.com/reddits-logged-in-google-ai-overviews-traffic-2026-10
1•lakeviewterrace•50s ago•0 comments

Unauthenticated RCE vulnerability against ClickHouse Server

https://cve.now/CVE-2026-116366
2•dkgs•1m ago•0 comments

Intel to buy quantum firm Classiq for about $2.3B

https://www.reuters.com/technology/intel-buy-quantum-firm-classiq-about-23-billion-bloomberg-news...
3•wslh•3m ago•0 comments

Slotwatch – watch Postgres replication slots from the terminal

https://github.com/Dem1241/slotwatch
2•ish1907•3m ago•0 comments

SpaceX No longer needs NASA

https://arstechnica.com/space/2026/10/spacex-no-longer-needs-nasa-and-thats-a-problem-for-america...
3•amosj•4m ago•0 comments

Write All the Things

https://asbedb.dev/musings/write-all-the-things
2•etvoila•5m ago•0 comments

Embraer's Atech aims to double in size by 2030 with drone traffic control

https://www.bloomberglinea.com.br/negocios/atech-da-embraer-quer-dobrar-de-tamanho-ate-2030-com-c...
2•dvaplima•5m ago•0 comments

Programming at Light Speed: Building the Gravity Query Engine

https://pgrust.com/blog/programming-at-light-speed/
2•poly2it•6m ago•0 comments

When Causal Is Not Enough in Drug Develompent

https://www.jacc.org/doi/10.1016/j.jacc.2026.09.005
1•brandonb•8m ago•0 comments

Product Managers aren't safe either

https://lucaskostka.com/posts/ai-challenges-more-than-devs
1•greatNespresso•9m ago•0 comments

You Can See Everything That Billy Evans Watched on 2x Speed

https://www.nytimes.com/2026/10/30/upshot/billy-evans-you-can-see-everything.html
1•tysone•10m ago•0 comments

Rian Johnson's Ideal iPhone Camera App

https://twitter.com/rianjohnson/status/2115436064458621189
1•spenceratkin•12m ago•0 comments

Fun Little Educational Game

https://www.metergraph.dev/arbitrage/
1•VasiliyRad•12m ago•0 comments

Show HN: Automatic deduction of FlashAttention kernel from ~25 lines of SQL

https://github.com/xqlsystems/xarray-sql/blob/6debe2495dcb4e8fac20ab97df5b89baae2a31a6/benchmarks...
2•alxmrs•14m ago•0 comments

An Arrogant Way of Killing (2016)

https://magazine.atavist.com/2016/an-arrogant-way-of-killing
2•firefax•15m ago•0 comments

Trump Phone Durability Test – Its worse than we thought (JerryRigEverything) [video]

https://www.youtube.com/watch?v=5O-vCJW1b8g
1•MasterYoda•17m ago•0 comments

PostgreSQL 19 Running Behind Schedule Due to AI/LLM Burden

https://www.phoronix.com/news/PostgreSQL-19-Late
1•dboon•18m ago•0 comments

I'm in 'You Can See Everything.' Here's My Side of the Story

https://www.nytimes.com/2026/10/30/opinion/you-can-see-everything-elizabeth-holmes-nathan-fielder...
2•brandonb•18m ago•0 comments

HTTP/HTTPS Debug Proxy

https://novawire.dev
1•vewello•21m ago•0 comments

Talk Without Talking

https://subvocal.company/
2•jbredeche•21m ago•0 comments

Show HN: Cerebellum – small model on the robot, big model for what it can't undo

https://github.com/cerebellum-labs/cerebellum
2•dminglv•22m ago•0 comments

FomoMate – Group plans with In or Out, no "Maybe

https://www.fomomate.com
1•mrunalmodi•23m ago•0 comments

Agents repurposed anti-itch drugs to neutralize the Bundibugyo ebolavirus

https://muni.bio/research/hits-from-ebolathon
2•4714•23m ago•1 comments

Jules Verne's Lost Novel

https://blue-continuum.com/verne-paris
3•dnetesn•29m ago•0 comments

EasyRE-Agent – an AI agent that solves crackmes and checks its own answers

https://github.com/wojtas99/EasyRE-Agent
1•krawczorek•29m ago•0 comments

Cold Triggers a Hidden Molecular Pathway That Extends Lifespan

https://www.sciencealert.com/cold-triggers-a-hidden-molecular-pathway-that-extends-lifespan-study...
7•dxs•30m ago•0 comments

Tecolot – A high-performance native terminal for macOS

https://tecolot.com/
1•simjue•30m ago•2 comments

HN Best Comments Scare-Quotes edition

https://hackertrain.future-secured.com/?offline_scare_quotes=1
1•adrianwaj•31m ago•0 comments

Pilot-wave hydrodynamics (Quantum phenomena in macroscopic hydrodynamic systems)

http://thales.mit.edu/bush/index.php/4801-2/
1•peter_d_sherman•31m ago•0 comments