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

Cara menonaktifkan akun di aplikasi uatas

1•hajkmba•19s ago•0 comments

Show HN: The missing layer between Claude Code and production-ready software

https://claudekit.cc
2•mrgoonie•9m ago•0 comments

Periodic Spaces

https://ianthehenry.com/posts/periodic-spaces/
1•memalign•11m ago•0 comments

Using Energy Prediction to Better Plan Cron Jobs

https://brainbaking.com/post/2025/11/using-energy-prediction-to-better-plan-cron-jobs/
1•ingve•12m ago•0 comments

The hottest Stanford computer science class is embracing, not banning, AI tools

https://www.businessinsider.com/uneasy-time-to-be-a-computer-science-student-at-stanford-2025-11
1•TMWNN•14m ago•1 comments

ShowHN: YouReadTube

https://www.youreadtube.com/scribe
1•ldenoue•19m ago•2 comments

India orders mobile phones preloaded with government app to ensure cyber safety

https://www.reuters.com/sustainability/boards-policy-regulation/india-orders-mobile-phones-preloa...
2•jmsflknr•19m ago•0 comments

Multi Repo Tool

https://github.com/njoshi22/repoflow
2•anduril22•24m ago•2 comments

Show HN: Photo app that does just one thing – no stories/reels/algorithm

https://www.drfts.app/
1•amiban•24m ago•0 comments

Cocoon – Confidential Compute Open Network by Telegram

https://cocoon.org
1•alebaffa•27m ago•0 comments

Aswath Damodaran – Laws of Valuation: Revealing the Myths and Misconceptions [video]

https://www.youtube.com/watch?v=c20_S-QgvsA
1•kamaraju•27m ago•0 comments

SemiAnalysis – TPUv7: Google Takes a Swing at the King

https://www.patreon.com/posts/144767388
1•gmays•28m ago•0 comments

How Prompt Caching Works – Paged Attention and Automatic Prefix Caching

https://sankalp.bearblog.dev/how-prompt-caching-works/
2•mji•28m ago•0 comments

Scientology-Linked Startup Dream Exchange Loses Bid for SEC License

https://www.wsj.com/finance/regulation/dream-exchange-sec-license-rejection-scientology-a7c64ce4
1•JumpCrisscross•29m ago•0 comments

Nonsurgical treatment shows promise for targeted seizure control

https://medicalxpress.com/news/2025-11-nonsurgical-treatment-seizure.html
1•PaulHoule•29m ago•0 comments

Skill Bank – AI agents with semantic discovery and memory/learning

https://github.com/MauricioPerera/Skill-Bank
1•rckflr•30m ago•1 comments

Show HN: Furnace – the ultimate chiptune music tracker

1•hilti•33m ago•0 comments

One jobserver to rule them all

https://blogs.gentoo.org/mgorny/2025/11/30/one-jobserver-to-rule-them-all/
1•todsacerdoti•35m ago•0 comments

Jargon.txt (1988)

https://www.dourish.com/goodies/jargon.html
2•swatson741•35m ago•0 comments

Show HN: Ode, a self-hosted app for writers who love the craft

https://github.com/DeepanshKhurana/ode
2•deepanshkhurana•36m ago•0 comments

The AI bubble isn't new – Karl Marx explained it nearly 150 years ago

https://theconversation.com/the-ai-bubble-isnt-new-karl-marx-explained-the-mechanisms-behind-it-n...
10•devonnull•44m ago•0 comments

I built Pinpoint: a daily mini-game for discovering your city

https://imperfectionist.substack.com/p/how-i-built-pinpoint
1•bibekg•57m ago•0 comments

Show HN: CurioQuest – A simple web trivia/fun facts game

https://curioquest.fun/
3•mfa•1h ago•0 comments

Antimatter Development Program

https://caseyhandmer.wordpress.com/2025/11/26/antimatter-development-program/
1•surprisetalk•1h ago•0 comments

Just ten species make up almost half the weight of all wild mammals

https://ourworldindata.org/wild-mammal-biomass-dominance
3•surprisetalk•1h ago•1 comments

When Was TidalCycles Born?

https://slab.org/2025/11/25/when-was-tidalcycles-born/
2•surprisetalk•1h ago•0 comments

It’s been a very hard year

https://bell.bz/its-been-a-very-hard-year/
40•surprisetalk•1h ago•16 comments

What's Happening with Hypermode?

1•sthala•1h ago•0 comments

Google Antigravity Deletes D Drive

https://mastodon.gamedev.place/@bastardsheep@aus.social/115641546248437052
42•jay_kyburz•1h ago•11 comments

Upgrade a ThinkPad 701c in 2023. (2023)

https://old.reddit.com/r/thinkpad/comments/185y4m6/upgrade_a_thinkpad_701c_in_2023/
2•mitthrowaway2•1h ago•0 comments