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?

Archaeology team unearths 'prototype' of world-famous Stonehenge monument

https://apnews.com/article/stonehenge-britain-discovery-summer-solstice-36f8517159a9e750c1042bebd...
1•zdw•3m ago•0 comments

I made a free Islamic prayer app to quit saying "I'll pray in 5 minutes"

https://better-prayer.com
2•Adam-Hincu•3m ago•1 comments

Why recruiters can't find workers and new grads can't find jobs (it's not AI)

https://www.washingtonpost.com/education/2026/07/12/why-recruiters-cant-find-workers-new-grads-ca...
1•rustoo•4m ago•0 comments

Nuclear war survival guide reveals seven everyday items if disaster strikes

https://www.dailymail.com/sciencetech/article-15795297/Forgotten-nuclear-war-survival-guide-revea...
2•Bender•10m ago•0 comments

Crayola Marker Airbrush Kit

https://www.crayola.com/products/toys/marker-airbrush-kit-747669
1•turtleyacht•10m ago•0 comments

MacSurf 2.0 – Netsurf for Mac OS 9 Released

https://github.com/mplsllc/macsurf/releases/tag/v2.0
1•mplsllc•12m ago•0 comments

Show HN: PitchTrail – Perfect Pitch for Kids

https://pitchtrail.app/
2•theckel•14m ago•0 comments

UN adopts first binding framework for automated driving systems

https://www.heise.de/news/Meilenstein-fuer-Robotaxis-UN-verabschiedet-globales-Recht-fuer-autonom...
1•logickkk1•17m ago•0 comments

What if Berlin needs its bunkers back?

https://www.ft.com/content/ec954bd3-a008-4561-978c-be1039f607d2
1•leonidasv•17m ago•1 comments

Kode Dot Programmable pocket device for makers, pentesters and geeks

https://kode.diy
2•iNic•17m ago•0 comments

Anthropic extends Fable 5 access through July 19

1•dboreham•17m ago•0 comments

Ask HN: List of functional institutions fighting towards a free internet

1•ronfriedhaber•17m ago•0 comments

Ask HN: What Are You Working On? (July 2026)

1•david927•18m ago•0 comments

Show HN: Tenclicker – a WebLLM clicker game about whatever you want

https://tenclicker.com
1•mattcheston•21m ago•0 comments

Analysis: Popular Chrome Extension ModHeader Exfiltrates User Data

https://aydinnyunus.github.io/2026/07/12/modheader-data-exfiltration-stanfordstudies/
1•runtimepanic•23m ago•0 comments

Free Community Radio Player (Win, Linux, Android, iOS)

https://radiodock.app/
2•bitmancer•25m ago•0 comments

Uber is lobbying to keep robotaxi rides 85% human in New Jersey

https://www.wired.com/story/ubers-autonomous-vehicle-strategy-slow-their-adoption/
2•logickkk1•25m ago•0 comments

Show HN: Capn-hook for coding agents – don't grep the same mystery twice

https://github.com/cyrusNuevoDia/capn-hook
3•knrz•27m ago•0 comments

We're extending Claude Fable 5 access through July 19

https://xcancel.com/claudeai/status/2076351399999557669
2•quantisan•27m ago•1 comments

Show HN: Agent-run – Run a coding agent in a sandboxed environment

https://github.com/sin-ack/agent-run
2•trashburger•28m ago•1 comments

Since Chronium 148, Math.tanh is now fingerprintable to link underlying OS

https://scrapfly.dev/posts/browser-math-os-fingerprint/
53•joahnn_s•32m ago•15 comments

The Meta Glasses backlash is changing how (or if) people use them

https://www.engadget.com/2212604/the-meta-glasses-backlash-is-changing-how-or-if-people-use-them/
7•gnabgib•34m ago•1 comments

Show HN: Adaptive Recall, persistent memory for AI assistants over MCP

https://www.adaptiverecall.com/
3•abratabia•36m ago•0 comments

Don't Build an RL Environment Startup

https://benanderson.work/blog/dont-build-rl-env-startup/
3•iacguy•37m ago•1 comments

Adapt, Improvise, and Overcome

https://briandouglas.ie/adapt-improvise-overcome/
2•inventor7777•37m ago•0 comments

Storm clouds gather over America's financial supremacy

https://www.economist.com/finance-and-economics/2026/07/12/storm-clouds-gather-over-americas-fina...
13•pseudolus•40m ago•1 comments

AI shorting penny stock based on human psychology

https://fadeengine.com
2•parth_nandaniya•41m ago•1 comments

Show HN: A subjective AI eval. Arcade games built by AI

https://ai-arcade.app
2•zapeterson16•43m ago•0 comments

Show HN: Summarize – local-first tool that turns videos into notes

https://martino.im/Summarize
2•martinopiaggi•48m ago•0 comments

UK has 'no future' if it fails to act on ecosystem collapse

https://www.theguardian.com/global-development/2026/jul/08/uk-report-ecosystem-collapse-national-...
10•mepian•49m ago•0 comments