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?

Financial arithmetic is kind of hard

https://blog.applied-algorithms.tech/financial-arithmetic-is-kind-of-hard
1•algorithmsRcool•4m ago•0 comments

Pilgrim raises $25M seed for biological threat detection device

https://wsj.com/tech/ai/anthropic-leaders-back-startup-developing-system-to-detect-biological-thr...
1•utiiiD•5m ago•0 comments

Ask HN: What Is It Like Working with Q/KDB+? Q/KDB+ Questions?

1•karakoram•6m ago•0 comments

McDonald's bets on chicken to win back diners as beef prices soar

https://www.ft.com/content/1d7daa8f-e8bb-436c-ad8b-b6d097e4107f
1•mikhael•6m ago•1 comments

OpenAI researchers might be spending >$4M/day on tokens (at API prices)

https://www.abtin.com/blog/2026-09-22-openai-spend.html
1•abtinf•7m ago•0 comments

Show HN: Diurnal – add a task without switching, with your calendar in view

https://diurnal.in/
1•aashu0148•9m ago•0 comments

Database of Databases VoltDB

https://dbdb.io/db/voltdb
1•Bluestein•13m ago•0 comments

Morgan Stanley Investment-Bank Deal List Leaked in Email Misfire

https://finance.yahoo.com/markets/stocks/articles/morgan-stanley-investment-bank-deal-124657863.html
2•wslh•15m ago•0 comments

Qwen Image 2.1 beats Google Nano Banana 2.0 with minuscule 7B parameter model

https://www.tomshardware.com/tech-industry/artificial-intelligence/alibaba-claims-new-qwen-image-...
4•speckx•16m ago•1 comments

Why didn't anybody tell me about Redis Hash Slots?

https://blog.verygoodsoftwarenotvirus.dev/posts/2026/09/23/why-didnt-anybody-tell-me-about-hash-s...
1•badrequest•16m ago•0 comments

UK on course to miss climate targets, energy secretary admits

https://www.ft.com/content/850dde98-834f-4cfe-9ffc-3e41980a4e9d
2•alephnerd•17m ago•1 comments

Italian parliament votes for return to nuclear energy

https://apnews.com/article/italy-nuclear-chernobyl-4891b6b7c7791ae84db6b0bf0f7cf567
3•geox•17m ago•0 comments

Fertility rate dropped over 50% within 10 years in Argentina

https://twitter.com/JesusFerna7026/status/2102768454935748701
2•jameslk•19m ago•1 comments

I Love Webrings

https://www.zwhuang.dev/blog/webrings
1•speckx•19m ago•0 comments

Trump TV: The Essentials Station

https://www.whitehouse.gov/videos/trump-tv-the-essentials-station/
4•TechTechTech•19m ago•1 comments

The Download: India's smart glasses menace and AI's trillion-dollar gamble

https://www.technologyreview.com/2026/09/23/1144966/the-download-india-smart-glasses-ai-trillion-...
1•joozio•22m ago•0 comments

Show HN: Psychosis Guard – Safety for long LLM conversations

https://github.com/nwjang/psychosis-guard
1•nwjang•23m ago•0 comments

Administrative friction: moving within the EU

https://michaelhillaert1.substack.com/p/administrative-friction
1•michaelhillaert•24m ago•0 comments

Tests of the New AI Siri

https://pogueman.substack.com/p/125-tests-of-the-new-ai-siri
1•rudx•24m ago•0 comments

Show HN: Powerful Org-Mode at Home on iOS

https://apps.apple.com/us/app/orger/id6775281796
1•surfcao•28m ago•0 comments

Show HN: Sanemark – Markdown LSP for notes readable in plain text

https://github.com/nkitsaini/sanemark
1•nkit•29m ago•0 comments

Serve DiffusionGemma-Jev (Djev) on a TypeSafe AI Compatible API

https://github.com/taeold/djev-run
1•_js•30m ago•0 comments

Bernie Sanders proposes to ban 'superintelligence' and put violators in prison

https://www.theverge.com/ai-artificial-intelligence/999443/bernie-sanders-ai-superintelligence-ba...
3•droidjj•32m ago•2 comments

Rat Stack: reference for building an app and its cloud as one typed program

https://ratstack.sh/
1•handfuloflight•34m ago•0 comments

The Social Reckoning

https://thesocialreckoning.com.au/home/
1•andrewstuart•34m ago•0 comments

The web being slow is a choice (and it's a stupid choice)

https://albanbrooke.com/slow-web/
1•speckx•34m ago•2 comments

Programming Tutorials Are Dead

https://robrace.dev/blog/programming-tutorials-are-dead/
2•polysaturate•35m ago•1 comments

Paramount weighs tapping Musk for equity investment

https://www.semafor.com/article/09/23/2026/paramount-weighs-tapping-musk-for-equity-investment
1•cdrnsf•35m ago•0 comments

Show HN: Ox – A local agent that uses the internet for you

https://openox.ai/
2•ziyzhu•36m ago•0 comments

Fire the slop cannons (safely): on coding agents and sandboxing

https://www.latacora.com/blog/2026/09/18/fire-the-slop-cannons-safely-on-coding-agents-and-sandbo...
1•aray07•36m ago•0 comments