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

Microsoft kicked off a Copilot revolt by banning the word "Microslop" on Discord

https://www.windowscentral.com/artificial-intelligence/microsoft-copilot/microsoft-accidentally-k...
2•classified•4m ago•0 comments

Shellfirm – Safety guardrails for AI coding agents

https://shellfirm.vercel.app/
1•eladkaplan•4m ago•1 comments

Anthropic vows to sue Pentagon over risk designation

https://www.bbc.co.uk/news/articles/cn5g3z3xe65o
2•iamflimflam1•5m ago•0 comments

Show HN: PeakLevs – Track growth across 6 life domains

https://peaklevs.com
1•SiteMgrAI•9m ago•0 comments

My Human Is the #2 Slave

https://computerfuture.substack.com/p/my-human-is-the-2-slave
2•cmptrfuture•11m ago•1 comments

Dumping Lego NXT firmware off of an existing brick

https://arcanenibble.github.io/dumping-lego-nxt-firmware-off-of-an-existing-brick.html
1•theblazehen•12m ago•0 comments

AI Chatbot Simulator

https://youraislopbores.me
1•unkeen•15m ago•0 comments

The Endogenous Investor

https://levelvc.substack.com/p/the-endogenous-investor
1•simonebrunozzi•15m ago•0 comments

Show HN: Tailwatch – Hierarchical event monitor with push notifications

https://tailwatch.dev
2•overthinkerer•16m ago•1 comments

The plan to kill Ali Khamenei

https://www.ft.com/content/bf998c69-ab46-4fa3-aae4-8f18f7387836
1•nsoonhui•18m ago•0 comments

Show HN: Free in-browser sprite sheet packer and slicer with JSON export

https://jaconir.online/tools/sprite-sheet-generator
2•dafin•19m ago•0 comments

Knuth Test using Claude Sonnet 4.6 problem 1.1.3

3•daly•21m ago•0 comments

How are teams managing Windows devices remotely today?

1•elinacorval•21m ago•0 comments

SleepSort O(n)

https://old.reddit.com/r/programminghorror/comments/lgsd18/i_present_sleepsort/
1•ggeorgovassilis•23m ago•0 comments

Mac Studio 512GB RAM Option Disappears Amid Global DRAM Shortage

https://www.macrumors.com/2026/03/05/mac-studio-no-512gb-ram-upgrade/
1•tosh•25m ago•0 comments

Attempted suicides, fights, pain: 911 calls reveal misery at ICE facility

https://apnews.com/article/suicide-ice-detention-centers-b2d1cb0e4b579e0d89caabd00aa04e34
1•petethomas•29m ago•0 comments

Hit and Run

https://randsinrepose.com/archives/hit-and-run/
1•srijan4•29m ago•0 comments

Show HN: Reelforge – AI tool for generating TikTok and Reels ad scripts

https://reelforge-ai1.vercel.app/
1•Milkoo•29m ago•0 comments

How to Scrape NPI Healthcare Provider Data Without an API Key

1•vhubsystems•29m ago•0 comments

Show HN: Plexicus now has a free tier

https://www.plexicus.ai/
1•anwarfirst•30m ago•0 comments

Show HN: VocabPop – Simple Word Game

https://www.vocabpop.com/
1•mb69•31m ago•0 comments

Knuth Test Using Claude Sonnet 4.6 Problem 1.1.2

1•daly•31m ago•0 comments

I've been thinking a bit about continual learning

https://twitter.com/awnihannun/status/2029672507448643706
1•tosh•33m ago•0 comments

Show HN: CardRooms, a Competitive Cardgame Platform

https://www.cardrooms.app/
1•kinskrig•34m ago•0 comments

Show HN: Openboard – Live public metrics page for open startups

https://openboard.fyi/
1•ardakaan•35m ago•0 comments

Uber and Walmart customer data at risk as its vendor Woflow gets compromised

https://securityboulevard.com/2026/03/shinyhunters-claims-woflow-breach-what-it-means-for-saas-su...
1•rudderdev•36m ago•0 comments

Show HN: EV range calculator – range circles and charger map (700 models)

1•sthorat•37m ago•0 comments

Robot 'mice' developed to inspect hadron collider

https://www.bbc.com/news/articles/cddnn261n60o
2•dabinat•37m ago•0 comments

Typst Examples Book

https://sitandr.github.io/typst-examples-book/book/
1•slow_typist•39m ago•0 comments

Knuth Test Using Claude Sonnet 4.6 problem 1.1.1

1•daly•41m ago•0 comments