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: Cornifi split keyboard, a more staggered corne

https://github.com/v3lmx/cornifi
1•v3lmx•2m ago•0 comments

The Architecture of "Not Bad": Decoding the Chinese Source Code of the Void

https://suggger.substack.com/p/the-architecture-of-not-bad-decoding
1•Suggger•2m ago•0 comments

Django RAPID Architecture, a guide to structuring Django projects

https://www.django-rapid-architecture.org/
1•j4mie•3m ago•1 comments

"Where Winds Meet Guide – Complete Mechanics, Builds, and Flight Unlocks"

https://www.wherewindsmeetguide.com/
2•causalzap•3m ago•0 comments

Integrating Toon into Visual Studio Code

https://github.com/mateolafalce/toon-context-optimizer
1•lafalce•6m ago•0 comments

Pydantic-resolve: A solid tool for building graph-like data

https://github.com/allmonday/pydantic-resolve
2•tank-34•8m ago•1 comments

Cocaine widely detected in some of Northern Ireland's major lakes and rivers

https://www.bbc.com/news/articles/c8r3vk8dvj2o
1•bookofjoe•8m ago•1 comments

Ask HN: Share Useful Prompts

1•rando77•9m ago•0 comments

Disney making $1B investment in OpenAI, will allow characters on Sora AI

https://www.cnbc.com/2025/12/11/disney-openai-sora-characters-video.html
2•tiahura•11m ago•1 comments

Beginner friendly cyber security challenges

https://knox.sethmb.xyz
1•isaluki•12m ago•1 comments

Directory of Padel Apps: with features, estimates and KPIs

https://padel.productcrafters.io
1•oleg2014•13m ago•0 comments

Sid Meier: More Than Just Civilization

https://boilingsteam.com/sid-meier-more-than-just-civilization/
2•ekianjo•14m ago•0 comments

NATO's Rutte warns against a war on the scale of that seen by past generations

https://www.reuters.com/business/aerospace-defense/natos-rutte-warns-allies-they-are-russias-next...
2•vincent_s•14m ago•0 comments

You aren't gonna need it

https://en.wikipedia.org/wiki/You_aren%27t_gonna_need_it
1•nomilk•16m ago•0 comments

Turn any Android app into an API

https://revrse.ai/
1•arsrev•17m ago•0 comments

Skydiver suspended below aircraft after accidental reserve chute deployment

https://www.atsb.gov.au/media/news-items/2025/skydiver-suspended-below-jump-aircrafts-tailplane-a...
1•tailspin2019•17m ago•1 comments

AI optimism is a class privilege

https://joshcollinsworth.com/blog/sloptimism
1•todsacerdoti•18m ago•0 comments

The Walt Disney Company and OpenAI Partner on Sora

https://openai.com/index/disney-sora-agreement/
2•inesranzo•18m ago•2 comments

Ten key insights from development economics in 2025

https://voxdev.org/topic/ten-key-insights-development-economics-2025
1•alphabetatango•19m ago•0 comments

Quantum clues to consciousness: the brain may harness the zero-point field

https://phys.org/news/2025-12-quantum-clues-consciousness-brain-harness.html
2•stOneskull•22m ago•1 comments

The Architects of AI Are TIME's 2025 Person of the Year

https://time.com/7339685/person-of-the-year-2025-ai-architects/
1•lode•22m ago•0 comments

Blue Origin's Orbital Data Centers Signal a New Era of Power, Politics, and Risk

https://comuniq.xyz/post?t=602
1•01-_-•22m ago•0 comments

Why are my view transitions blinking?

https://piccalil.li/blog/why-are-my-view-transitions-blinking/
1•bk496•25m ago•0 comments

Linux Foundation Announces the Formation of the Agentic AI Foundation

https://www.linuxfoundation.org/press/linux-foundation-announces-the-formation-of-the-agentic-ai-...
2•svoit•25m ago•0 comments

A customizable agentic AI toolkit for e-commerce

https://upsidelab.io/tools/enthusiast
1•vast-alive•26m ago•0 comments

What happens when you add a new Teller?

https://www.johndcook.com/blog/2008/10/21/what-happens-when-you-add-a-new-teller/
1•bschne•26m ago•0 comments

I built a browser tool that converts ANY file → Markdown

https://www.loom.com/share/d854af039e364fb28ca006d4654257ca
1•gavrielamati•29m ago•0 comments

Is GitHub Down?

5•henriquenunez•29m ago•2 comments

Twin suction turbines and 3-Gs in slow corners? Meet the DRG-Lola

https://arstechnica.com/cars/2025/11/an-electric-car-thats-faster-than-f1-around-monaco-thats-the...
1•PaulHoule•30m ago•0 comments

Two Elegant Use Cases for Go Build Tags

https://btema.net/blog/two-elegant-use-cases-for-go-build-tags/
2•machine424•30m ago•0 comments