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?

Show HN: I hired AI to fix my memory, but made it 100% Offline for privacy

https://namememory.netlify.app/
1•KasamiWorks•39s ago•0 comments

Stronk.app – open-source gym lifts journal

1•apatheticonion•2m ago•0 comments

Unifi Travel Router

https://blog.ui.com/article/travel-in-style-unifi-style-unifi-travel-router
1•flurdy•2m ago•0 comments

What's "new" in Miri (and also, there's a Miri paper)

https://www.ralfj.de/blog/2025/12/22/miri.html
1•birdculture•3m ago•0 comments

Unifi Travel Router

https://www.youtube.com/watch?v=Sja3pxedlLs
2•flurdy•4m ago•0 comments

High-performance C++ hash table using grouped SIMD metadata scanning

https://github.com/Cranot/grouped-simd-hashtable
1•rurban•5m ago•0 comments

Online resource shows people how to identify poisonous Virginia mushrooms

https://thefnp.com/
1•gnabgib•7m ago•0 comments

December Was Deadliest Month in Deadliest Year in ICE Custody Deaths

https://newrepublic.com/post/204742/december-2025-deadliest-month-year-ice-detention-immigrant-de...
1•petethomas•8m ago•0 comments

The Phone-Based Retirement Is Here

https://www.theatlantic.com/technology/2025/12/do-your-parents-have-screen-time-problem/685424/
1•petethomas•10m ago•0 comments

Strongs Dictionary Concordance

https://biblehub.com/greek/594.htm
2•marysminefnuf•10m ago•0 comments

The Deadweight Loss of Entertainment – Go do things even if you don't want to

https://moultano.wordpress.com/2025/12/09/the-dead-weight-loss-of-entertainment/
1•moultano•14m ago•0 comments

Dan Luu: Reasoning about performance (2016) [video]

https://www.youtube.com/watch?v=80LKF2qph6I
1•rglover•20m ago•0 comments

Krawl: A Honeypot and Deception Server

https://github.com/BlessedRebuS/Krawl
2•blessedrebus•21m ago•0 comments

Americans Have Mixed Views of AI – and an Appetite for Regulation

https://www.searchlightinstitute.org/research/americans-have-mixed-views-of-ai-and-an-appetite-fo...
2•in-silico•23m ago•1 comments

Artist's Collection of Weird Google Street View Images Gets Major Exhibit

https://petapixel.com/2025/12/10/artists-collection-of-weird-google-street-view-images-gets-major...
2•gnabgib•23m ago•0 comments

SwiftZilla – RAG with Official Apple Docs for Swift Agents (MCP/Cursor/Claude)

https://swiftzilla.dev
1•vituu•23m ago•1 comments

Cultural Institutions Are Erasing Christianity

https://thecritic.co.uk/cultural-institutions-are-erasing-christianity/
1•barry-cotter•30m ago•1 comments

New UK home-maintenance membership (waitlist open)

1•mykelcodes•30m ago•0 comments

Token-Count-Based Batching: Faster, Cheaper Embedding Inference for Queries

https://www.mongodb.com/company/blog/engineering/token-count-based-batching-faster-cheaper-embedd...
1•fzliu•30m ago•0 comments

Show HN: We built a native bridge to make WebRTC calls reliable in hybrid apps

1•Mincirkel•32m ago•0 comments

Espruino: Embedded JavaScript,dev boards and smart watch

https://www.espruino.com
2•jgrizou•33m ago•1 comments

US targets former EU commissioner with visa bans over alleged censorship

https://www.reuters.com/legal/government/us-targets-former-eu-commissioner-activists-with-visa-ba...
3•amarcheschi•34m ago•1 comments

Macroni – open-source DSL for human-like macroing

https://github.com/srschreiber/macroni
1•srschreiber•41m ago•1 comments

Show HN: I automated Warren Buffett's brain on Poe. It's uncomfortably accurate

https://poe.com/BuffettlyAI
1•simullab•43m ago•2 comments

Design Patterns for Decentralized Protocols (2020) [video]

https://www.youtube.com/watch?v=JDrdgk1L-ww
1•teleforce•47m ago•0 comments

Scientists Unlock a New Way to Hear the Brain's Hidden Language

https://scitechdaily.com/scientists-unlock-a-new-way-to-hear-the-brains-hidden-language/
2•andsoitis•50m ago•0 comments

Piling Up Sheets / the face in the soup bowl

https://jens.mooseyard.com/1995/08/23/piling-up-sheets-/-the-face-in-the-soup-bowl/
1•andsoitis•51m ago•0 comments

Compiler Explorer

https://godbolt.org
1•andsoitis•52m ago•0 comments

CASA: Cross-Attention via Self-Attention

https://kyutai.org/casa
2•swyx•52m ago•0 comments

US bars 5 Europeans it says pressured tech firms to censor American viewpoints

https://apnews.com/article/state-department-trump-immigration-rubio-visas-87c8a4692f3184e4f83fdd8...
11•c420•57m ago•2 comments