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?

The Hackers Choice: Segfault (Disposable Root Servers)

https://www.thc.org/segfault/
1•o_-_o•1m ago•0 comments

This QR code is a language model

https://q.shayon.work/home/
1•yewenjie•1m ago•0 comments

Eagles are eating human-sized baboons in the Sahara desert

https://www.popsci.com/environment/eagles-eating-baboons-sahara/
1•gmays•1m ago•0 comments

Show HN: Crabble – a free browser word game with bot tiers and post-game review

https://crabble.club
1•Shexfer•1m ago•0 comments

A Linux Desktop Environment - in Flutter!

https://github.com/miracle-wm-org/moonswing
1•matthewkosarek•2m ago•1 comments

The Silent Consensus

https://openai.com/index/the-silent-consensus/
1•bjornsing•2m ago•0 comments

Show HN: A live feed of people publicly asking to hire freelancers

https://evenleads.com/gigs
1•meriusbuap•3m ago•0 comments

GitLab 19.6.0 is out and still vulnerable to Ruby2Shell and NGINX2Root

1•hoechst•4m ago•0 comments

Fibonacci lattice: a simple way to distribute points on a sphere

https://www.johndcook.com/blog/2023/08/12/fibonacci-lattice/
1•fanf2•4m ago•0 comments

AMD Has Its Own China Problem (Hunterbrook, Short-Seller)

https://hntrbrk.com/investigations/amd-china
1•nycdatasci•5m ago•0 comments

MPs in PyTorch 2.15

https://huggingface.co/blog/mps-pytorch-2-15
1•0o777•5m ago•0 comments

Room-level Bluetooth tracking for Home Assistant

https://padspan.traks.ca/demo/
1•gbroeckling•6m ago•0 comments

Universities Need to Be Bolder

https://hollisrobbinsanecdotal.substack.com/p/universities-need-to-be-bolder
1•HR01•7m ago•0 comments

I built Cornhole News. A Hacker News inspired site for news across the Midwest

https://cornholenews.news
3•cornholemedia•8m ago•1 comments

Why AI Wants to Be Local – With Pete Warden (Creator of Moonshine Voice)

https://thedataexchange.media/pete-warden-moonshine/
2•datascientist•8m ago•0 comments

Do you need to register your MVP to validate your product

https://crosspoint.finance/blog/no-cac-registration-to-start-earning-online
1•BrownsonN•9m ago•0 comments

GTA VI didn't break the internet, thanks to 'stupid DNS tricks'

https://www.theregister.com/networks/2026/11/19/gta-vi-didnt-break-the-internet-thanks-to-stupid-...
2•nephihaha•9m ago•0 comments

Deceptive design patterns proposed to be banned by the Digital Fairness Act [pdf]

https://commission.europa.eu/document/download/a0539d90-2758-48e5-9010-1e856030d166_en?filename=A...
2•robin_reala•9m ago•0 comments

What is the future of cross-border payment

1•BrownsonN•11m ago•0 comments

Show HN: AI Kitchen Designer

https://www.aikitchendesign.co
1•atharvtathe•11m ago•0 comments

What Comes After AGI?

https://institute.deepmind.com/essays/what-comes-after-agi/
1•dvaplima•12m ago•0 comments

Featherweight, flying robot carries its own sensors and computers

https://news.mit.edu/2026/featherweight-flying-robot-carries-its-own-sensors-and-computers-1118
1•gmays•13m ago•0 comments

Show HN: Watch weight-space programming in action with WebGPU

https://tabbyml.github.io/weight-space-playground/
2•wsxiaoys•13m ago•0 comments

"Independent" AI Safety Groups Are Pumping Anthropic's IPO [video]

https://www.youtube.com/watch?v=pyRG_5dCrfg
2•smukherjee19•14m ago•0 comments

The Life of the Plant: Ten Popular Lectures (1958) [Mir Publishers Moscow]

https://archive.org/details/kliment-timiryazev-the-life-of-the-plant-ten-popular-lectures-flph-1958
1•vismit2000•14m ago•0 comments

Show HN: Gh-sift – PRs, Diffs, Actions logs and stacked PRs in one TUI

https://github.com/chrismatix/gh-sift
1•chrismatic•15m ago•0 comments

My Blog Is Now a Rendering Engine That Happens to Have Text

https://elliotbonneville.com/a-rendering-engine-that-happens-to-have-text/
1•elliotbnvl•16m ago•0 comments

Switching LLMs mid-conversation is a ski-rental problem

https://www.edgee.ai/blog/posts/switching-llms-mid-conversation-is-a-ski-rental-problem
1•gmays•16m ago•0 comments

FolderFeed: Keep up with your team's Google Drive activity

https://www.folderfeed.com/
1•oburlaca•16m ago•0 comments

Shenzhen Peace Declaration

https://eualive.net/the-shenzhen-peace-declaration-has-nothing-to-say-about-ukraine/
1•zaikunzhang•19m ago•0 comments