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?

Reading Is a System

https://docs.google.com/presentation/d/1rPX2rZ80CmHJCKZBziS1BtdodQM4NJhkNIz8EhF9nHM/edit?usp=sharing
1•_bramses•29s ago•0 comments

Tesla gets go-ahead to sell self-driving technology in Belgium

https://www.reuters.com/business/autos-transportation/tesla-gets-go-ahead-sell-self-driving-techn...
1•andsoitis•35s ago•0 comments

Blindzone Glare Elimination Mirror Method [pdf]

https://www.nhtsa.gov/sites/nhtsa.gov/files/blindzoneglaremirrormethod.pdf
1•thunderbong•56s ago•0 comments

Sophia NLU Home Assistant – On Device, Low Compute, No Internet, Voice Assistant

1•aquila416•2m ago•0 comments

A 60fps eInk Monitor, the Modos Flow [video]

https://www.youtube.com/watch?v=nHbA2-_qzH4
1•razorbeamz•5m ago•0 comments

Stdx, Rust's extended standard library

https://kerkour.com/stdx
1•manyatoms•5m ago•0 comments

Harry's Game (ITV, 1982)

https://archive.org/details/harrys-game-episode-2
1•petethomas•8m ago•0 comments

Simplify: Move Code into Database Functions

https://sive.rs/pg
1•privong•8m ago•0 comments

Voronoi Village

https://wwwtyro.github.io/voronoi-village/
1•wwwtyro•14m ago•1 comments

Katja Hoyer on Weimar, the GDR, and the German Character (Ep. 279)

https://conversationswithtyler.com/episodes/katja-hoyer/
1•paulpauper•16m ago•0 comments

Engineers aren't afraid of AI – they're afraid of becoming junior again

https://www.andykelk.net/leadership/your-engineers-arent-afraid-of-ai-theyre-afraid-of-being-juni...
2•mopoke•23m ago•0 comments

Built to benefit everyone: our plan

https://openai.com/index/built-to-benefit-everyone-our-plan/
2•gmays•23m ago•0 comments

ShieldMCP – Security scanner for your MCP config

https://shieldmcp.net
1•ccellcdev•23m ago•0 comments

Show HN: MandoCode – local-first AI coding agent (.NET and Ollama)

https://github.com/DevMando/MandoCode
1•devmando•29m ago•0 comments

Are you ready to admit it's the phones?

https://www.noahpinion.blog/p/are-you-finally-ready-to-admit-its
2•paulpauper•33m ago•0 comments

A simple reason for skepticism about the iPhones/fertility link

https://marginalrevolution.com/marginalrevolution/2026/06/a-simple-reason-for-skepticism-about-th...
1•paulpauper•33m ago•0 comments

What is the most sophisticated piece of software ever written?

https://www.quora.com/What-is-the-most-sophisticated-piece-of-software-ever-written-1/answer/John...
1•sorentwo•40m ago•0 comments

Iran-backed hackers claim breach of California water systems over US attacks

https://bsky.app/profile/shipwreck75.bsky.social/post/3mo2qvxsnjk2a
1•8ig8•45m ago•0 comments

Can I use Claude Design and Vercel Drop together?

https://vercel.com/i/claude-design-and-vercel-drop
2•flashbrew•48m ago•0 comments

How Our Reporters Distinguish Hype from Facts in the SpaceX IPO

https://www.nytimes.com/2026/06/11/insider/spacex-ipo-coverage-facts-price.html
1•1vuio0pswjnm7•49m ago•0 comments

The Evolution of 'More Like This'

https://manticoresearch.com/blog/the-evolution-of-more-like-this/
1•snikolaev•50m ago•0 comments

Records regarding the review of the Investigative Holdings related to J Epstein

https://vault.fbi.gov/records-regarding-the-review-of-the-investigative-holdings-related-to-jeffr...
1•sans_souse•51m ago•0 comments

Fylun.ai – All-in-one AI workspace (chat, notes, apps, automation, search)

https://fylun.ai
1•im-tyler•51m ago•0 comments

StonkRider – Ride any stock chart

https://stonkrider.com/
1•nreece•53m ago•0 comments

500-year-old monasteries outperform at digital transformation (U. of Zurich)

https://phys.org/news/2026-05-historic-monasteries-digital-countries.html
1•indynz•53m ago•0 comments

Ex-Andreessen Horowitz partner: old firm, VCs 'political infiltration' on AI

https://www.cnbc.com/2026/06/11/ex-a16z-partner-slams-old-firm-othes-political-infiltration-in-ai...
4•1vuio0pswjnm7•58m ago•0 comments

Can Magnetic Forces Do Work? [pdf]

https://arxiv.org/abs/1911.08890
3•thunderbong•1h ago•0 comments

LLM podcast addressing AI genocide of humanity

https://MachineDeposition.com
1•maliapu•1h ago•1 comments

AI isn't making developers more productive – it's making them busier

https://leaddev.com/ai/ai-isnt-making-developers-more-productive-its-making-them-busier
3•nreece•1h ago•0 comments

Image Compression

https://www.makingsoftware.com/chapters/image-compression
1•luispa•1h ago•0 comments