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

How Well Do New Python Type Checkers Conform?

https://sinon.github.io/future-python-type-checkers/
1•rbanffy•47s ago•0 comments

UK National Charged in Cyber Attacks, Including on Critical Infrastructure

https://www.justice.gov/opa/pr/united-kingdom-national-charged-connection-multiple-cyber-attacks-...
1•impish9208•1m ago•0 comments

Nepal Gen-Z Revolution

https://www.theguardian.com/world/2025/sep/10/nepal-gen-z-protests-corruption
2•shrubby•2m ago•0 comments

iOS 26's Liquid Glass Design Draws Criticism from Users

https://www.macrumors.com/2025/09/17/ios-26-liquid-glass-critiques/
1•wslh•3m ago•1 comments

When Justice Holds a Knife: reflections on the death penalty's irreversible edge

https://www.clickworlddaily.com/2025/09/when-justice-holds-knife-reflections-on.html
1•jonalgarve•4m ago•1 comments

Cladh Hallan

https://en.wikipedia.org/wiki/Cladh_Hallan
1•bediger4000•4m ago•0 comments

First large health language model predicts >1000 diseases for a person and when

https://erictopol.substack.com/p/dawn-of-a-new-era-of-primary-prevention
1•ck2•4m ago•1 comments

Secrets of DeepSeek AI model revealed in landmark paper

https://www.nature.com/articles/d41586-025-03015-6
2•bookofjoe•5m ago•1 comments

Why 'false authenticity' is so unsettling

https://psyche.co/notes-to-self/why-walking-through-historic-wurzburg-is-so-unsettling
1•herbertl•5m ago•0 comments

Why Your AI Code Bias Is Making You a Worse Reviewer

https://revelry.co/insights/artificial-intelligence/your-ai-code-bias-makes-you-a-worse-reviewer/
2•sighren•5m ago•0 comments

Discovering new solutions to century-old problems in fluid dynamics

https://deepmind.google/discover/blog/discovering-new-solutions-to-century-old-problems-in-fluid-...
1•roboboffin•6m ago•0 comments

Unlock one-of-a-kind shows in unique spaces

https://www.sofarsounds.com/
1•fcpguru•6m ago•0 comments

Feature Flags in Depth

https://rtpg.co/2023/11/15/feature-flags-in-depth/
1•rbanffy•7m ago•0 comments

Show HN: I wrote an OS in 1000 lines of Zig

https://github.com/botirk38/OS-1000-lines-zig
1•botirk•11m ago•1 comments

The Worldcoin Scam Just Got Worse [video]

https://www.youtube.com/watch?v=lAaIRWjKAmw
2•askl•11m ago•0 comments

Apple's Audio Labs

https://www.techradar.com/audio/earbuds-airpods/apple-took-me-into-one-of-the-quietest-rooms-anyw...
2•coloneltcb•11m ago•0 comments

Ask HN: Parental control for a 13yo, on Linux (remote, web-based, extensible)

1•markun•12m ago•0 comments

KDE offers a cool Mobile UI, too

https://plasma-mobile.org
1•eloeffler•14m ago•0 comments

Elasticsearch Was Never a Database

https://www.paradedb.com/blog/elasticsearch-was-never-a-database
5•todsacerdoti•15m ago•1 comments

Reactive carbon runoff from logged forests undermines climate mitigation

https://phys.org/news/2025-09-soil-runoff-forests-reactive-carbon.html
2•PaulHoule•15m ago•0 comments

US-UK pact will create jobs

https://www.gov.uk/government/news/us-uk-pact-will-boost-advances-in-drug-discovery-create-tens-o...
2•monkeydust•16m ago•0 comments

Japan to investigate undersea-cable supply chains for China exposure Asia

https://asia.nikkei.com/business/telecommunication/japan-to-investigate-undersea-cable-supply-cha...
2•rbanffy•17m ago•0 comments

Using GPT-5 to prove new theorems on matrix multiplication

https://rybindmitry.github.io/blogs/gpt5-matrix-multiplication.html
1•frozenseven•18m ago•0 comments

Erlang-Red – Interview with Gerrit Riessen at TADSummit

https://blog.tadsummit.com/2025/09/17/erlang-red/
1•vkatsuba•18m ago•0 comments

Google kept its lobbying on this privacy bill quiet

https://themarkup.org/privacy/2025/09/12/google-wasnt-against-this-privacy-bill-officially-behind...
3•eustoria•21m ago•0 comments

Humans still better than AI for hotdog or not

https://www.humanprotocol.org/blog/evaluating-google-cloud-vision-for-image-moderation-how-reliab...
4•alexnewman•21m ago•0 comments

Signals in the Fire: The Impact of Banning Global Tech in Nepal

https://schmud.de/posts/2025-09-18-signs-in-the-fire-kathmandu.html
1•schmudde•23m ago•1 comments

China-backed cyber crew spoof Congressman to dig for dirt on US trade talks

https://www.theregister.com/2025/09/18/pandamonium_chinabacked_attackers_spoof_congressman/
2•rntn•23m ago•0 comments

ErnieApp – Privacy Knowledge Manager

https://ernieapp.com/
1•eustoria•24m ago•0 comments

A blog about the Cedar Policy Language

https://cedarland.blog/
1•mooreds•28m ago•2 comments