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?

Elon Musk pours $366M into midterm Republican campaigns

https://www.cnbc.com/2026/10/22/elon-musk-midterm-election-spacex-tesla.html
1•Alien1Being•38s ago•0 comments

GitHub now uses a generic avatar instead of "Identicons" for new profiles

1•winkelmann•2m ago•0 comments

OpenAI trims valuation target after pitching higher price

https://www.ft.com/content/bb564eb1-79d4-4694-aa24-1155202a9abc
1•Alien1Being•2m ago•0 comments

DisplaySwitcher

https://nebulasoftware.com/product/displayswitcher/
1•BoydEdmondson•2m ago•0 comments

Geoffrey Hinton: 'I think there's a 1% chance it will destroy us'

https://english.elpais.com/science-tech/2026-10-21/geoffrey-hinton-the-godfather-of-ai-im-not-a-d...
1•geox•5m ago•0 comments

Attie

https://attie.ai/login
1•jcbhmr•6m ago•0 comments

US appeals court ejects judge from case over AI errors

https://www.reuters.com/legal/government/appeals-court-lifts-block-mississippis-dei-ban-ejects-ju...
2•droidjj•6m ago•0 comments

Integrating Better with Other ATProto Services

https://blog.wisp.place/posts/integrating-atproto/
1•jcbhmr•7m ago•0 comments

Canva's image model reaches #4 on Design Arena

https://twitter.com/DesignArena/status/2113349031762268476
1•dannyw•10m ago•0 comments

AI Is Changing Everything About Hacking. No One Knows What Happens Next

https://www.404media.co/php2shell-black-october-ai-is-changing-everything-about-hacking-no-one-kn...
1•carwil•10m ago•0 comments

PHP2Shell Services

https://php2shell.censys.com
1•cdrnsf•11m ago•0 comments

DuckDB 2.0 and the Query Farm extension repository

https://query.farm/blog/duckdb-2-query-farm-repository/
1•rustyconover•12m ago•0 comments

Machinists > Tailors

https://pauldambra.dev/2026/10/machinists-not-tailors.html
1•rbaudibert•13m ago•0 comments

Datacenters 2027: The Year of Acceleration, +50GW in a Single Year

https://newsletter.semianalysis.com/p/datacenters-2027-the-year-of-acceleration
1•mikhael•14m ago•0 comments

Local Wikipedia is Wikipedia, but only for things a half hour walk from you

https://edjefferson.com/localwiki/
2•sohkamyung•16m ago•0 comments

Fraud losses among older Americans hit $3B in 2025 as big losses surge: FTC

https://www.cnbc.com/2026/10/22/older-americans-fraud-losses-2025.html
2•pseudolus•17m ago•0 comments

Agentic ML Experimentation at Snap

https://eng.snap.com/alchemist
1•wyes•20m ago•0 comments

Tangled knot that runs on Cloudflare Workers

https://tangled.org/oppi.li/naut
1•jcbhmr•22m ago•0 comments

LLMs are making formal software verification feasible at a much larger scale

https://www.anthropic.com/research/formal-verification
1•johnbender•23m ago•0 comments

Death to long-lived static credentials

https://vercel.com/blog/death-to-long-lived-static-credentials
1•cramforce•24m ago•1 comments

Inkspo

https://inkspo.ai
2•patchtattoother•25m ago•1 comments

Intentionally Down

https://control.softlayer.com/
2•gfs•26m ago•0 comments

Show HN: Walkman – turn-by-turn routing in the browser, built from vector tiles

https://walkman.uz/
2•sardor_r1•27m ago•0 comments

Noise: Speedrun for Pretraining Without Backpropagation

https://qlabs.sh/noise#update
2•ZeroCool2u•27m ago•0 comments

Show HN: Taveo – Split bar and restaurant bills without sign-up

https://taveo.app/en
2•gallegodev•28m ago•1 comments

Startup plans to rejuvenate nuclear power industry with new manufacturing

https://news.mit.edu/2026/startup-rejuvenates-nuclear-power-industry-new-manufacturing-approach-1022
1•rbanffy•29m ago•0 comments

Kemp Folds: Ross Kemp's face, folded

https://kempfolds.blogspot.com/
2•tuvix•30m ago•0 comments

Man as Man: A Promise to the Dead

https://manasman.tiiny.site/png/man_as_man
1•shaunxcode•30m ago•0 comments

Created a free intuitive app to browse S3

https://s3-client-nu.vercel.app/
1•emilmoe•31m ago•0 comments

Emulator reimagines Nintendo's Virtual Boy with a full color display

https://arstechnica.com/gaming/2026/10/this-emulator-reimagines-nintendos-virtual-boy-with-a-full...
1•rbanffy•31m ago•0 comments