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?

Agent memory is leaving the cute "remember this" demo phase

https://self.md/signals/2026-06-17-expertise-context-memory
1•decorner•22s ago•0 comments

From news overload to actionable intelligence

https://sarniq.com/
1•zack001•31s ago•0 comments

Noctalia V5 and LabWC on NixOS

https://grigio.org/noctalia-v5-labwc-on-nixos/
1•grigio•1m ago•0 comments

Switchboard – route AI prompts instead of capping budgets

https://github.com/aivinay/switchboard
1•ai_vinaygupta•5m ago•0 comments

How Things Got to Be

https://medium.com/@osclark_68020/how-things-got-to-be-be4e72209ebd
1•JazzyRock•7m ago•0 comments

Building a Self-Hosted Cloud

https://lukaswerner.com/post/2026-06-29@dot-acm-0
3•chilipepperhott•11m ago•0 comments

The Dead Internet Is Real

https://moai.studio/blog/posts/the-dead-internet-is-real.html
3•ionwake•12m ago•0 comments

Original Organism, a living mathematical creature in the browser

https://sand-morph.up.railway.app/organism.html
1•echohive42•13m ago•0 comments

Things I Believe In

https://www.guidavid.com/writing/things-i-believe-in
1•gdss•14m ago•0 comments

A user-space firewall that gates an AI agent's actions

https://github.com/Vadale/project-guardian
1•grauk•17m ago•0 comments

Show HN: ForthWrite – Email AI that learns your voice from every edit you send

https://www.forthwrite.ai/blog/how-forthwrite-learns-your-email-voice
1•curtisboortz•17m ago•0 comments

Rethinking Software Engineering in the Age of AI

https://medium.com/@sharvanath/rethinking-software-teams-in-the-age-of-ai-ff5609701bf0
1•sharva•20m ago•0 comments

UK Government defends plan to switch off terrestrial TV

https://observer.co.uk/news/business/article/government-defends-plan-to-switch-off-terrestrial-tv
2•edward•20m ago•0 comments

High H-Index Revealed a Citation Ring

https://www.the-scientist.com/a-researcher-s-suspiciously-high-h-index-revealed-a-vast-citation-r...
1•lambda07•20m ago•0 comments

Show HN: Zenith: sota harness for normal models to beat Fable on FrontierSWE

https://ii.inc/blog/post/zenith
1•emadm•21m ago•0 comments

Qalculate Hacks

https://anarc.at/blog/2025-02-08-qalculate-hacks/
1•edward•21m ago•0 comments

Imali – an AI-assisted trading platform I built solo over the last 2 years

https://imali-defi.com/
1•Griffjoy•22m ago•0 comments

Ask HN: Is AI dumbing us down?

2•sarmadgulzar•23m ago•0 comments

Wine 11.12 – Run Windows Applications on Linux, BSD, Solaris and macOS

https://www.winehq.org/announce/11.12
2•neustradamus•24m ago•0 comments

MSCI keeps South Korea at emerging market status, cites FX accessibility

https://www.reuters.com/world/asia-pacific/msci-keeps-south-korea-emerging-market-status-cites-fx...
1•firasd•25m ago•0 comments

VictoriaLogs Stores Your Logs in a Columnar Layout

https://victoriametrics.com/blog/victorialogs-internals-columnar-storage-on-disk/index.html
2•birdculture•25m ago•0 comments

I Co-Founded Wikipedia. Now I'm Banned for Life

https://www.thefp.com/p/larry-sanger-wikipedia-co-founder-banned
1•donsupreme•27m ago•1 comments

Cepis Warns EU Against "Backdoor" Chat Monitoring in Child Protection Debate

https://cepis.org/cepis-warns-eu-against-backdoor-chat-monitoring-in-child-protection-debate/
2•latexr•28m ago•0 comments

Show HN: Kew, A distraction-free terminal music player, now on Windows

https://github.com/ravachol/kew
1•ravachol•29m ago•0 comments

Show HN: LiSkat: Free real-time Skat with Elo and bots

https://liskat.com
2•iNic•32m ago•1 comments

Show HN: We built a free LeetCode Alternative in 15 spoken languages

https://sharpskill.dev/en
1•Enjoyooor•35m ago•1 comments

Is It Out Yet?

https://outyet.ai
2•partsch•36m ago•0 comments

You really shouldn't copy-paste errors into Claude Code

https://home.robusta.dev/blog/you-really-shouldnt-copy-paste-errors-into-claude-code
3•nyellin•38m ago•0 comments

JetBrains' new AI-first IDE JetBrains Air is now on Windows

https://www.neowin.net/news/jetbrains-new-ai-first-ide-jetbrains-air-is-now-on-windows/
2•bundie•40m ago•0 comments

Avogadro's Number and the Stars – An Anthropic Near Miss

https://aleph.se/andart2/physics/avogadros-number-and-the-stars-an-anthropic-near-miss/
1•cws•46m ago•0 comments