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?

Unicode variation selector 15 and text vs. emoji presentation styles

https://benjaminwil.info/weblog/variation-selector-15/
1•fanf2•41s ago•0 comments

Show HN: YC Has It – describe your problem, find the YC startup that solves it

https://www.ychasit.com/
1•intelligentleak•1m ago•0 comments

The Ride Is the Ride

https://soloist.bearblog.dev/the-ride-is-the-ride/
1•mooreds•1m ago•0 comments

Polish-Lithuanian Commonwealth

https://u.osu.edu/poland/history/polish-lithuanian-commonwealth/
2•mooreds•4m ago•0 comments

LPC for Speech (1993)

https://lists.cpunks.org/archives/list/cypherpunks-legacy@lists.cpunks.org/message/PPN2I2MBKTAUZF...
2•basilikum•7m ago•0 comments

Show HN: A useful service for back end devs

https://app.linking.studio
2•yourfavdev•8m ago•0 comments

The Demographics of Central Europe [video]

https://www.youtube.com/watch?v=qvrj7_SMxao
2•mooreds•9m ago•0 comments

Why Garmin Bought TrainingPeaks

https://www.getvertical.ai/blog/garmin-trainingpeaks-acquisition/
2•mresposito•11m ago•0 comments

AMD EPYC 9006 Venice Announced and Looks Poised to Be a Grand Slam

https://www.phoronix.com/review/amd-epyc-9006-venice
2•ksec•12m ago•0 comments

Everybody Wants to Be a Dev

https://theturingmachine.net/everybody-wants-to-be-a-dev
2•birdculture•15m ago•0 comments

Show HN: Chrome extension for clean, readable SEC filings (10-K, 10-Q, 8-K)

https://chromewebstore.google.com/detail/sec-reader/jimblilpjbmhmgiooeobpabjnkadcoji
2•wenbin•15m ago•0 comments

First wave power plant receives DNV certification

https://www.heise.de/en/news/World-s-first-wave-power-plant-receives-DNV-certification-11373440.html
3•jonathanlydall•17m ago•0 comments

How to Check Aadhaar Card Status Online – SMFG India Credit

https://www.smfgindiacredit.com/knowledge-center/how-to-check-aadhaar-card-status-online.aspx
2•saumyaraut11•17m ago•0 comments

Orwell on AI

https://hegemon.substack.com/p/orwell-on-ai
3•aa_is_op•17m ago•0 comments

My football predictor scores 0.203 vs. the bookies' 0.198 – and loses

https://kickoffreport.com/how-our-prediction-model-works/
3•cmanoliu•22m ago•2 comments

A VSCode extension for AI to understand your project

2•bailingyuan•22m ago•0 comments

Cloudflare Nimbus – Docs for the agentic web

https://nimbus-docs.com/
2•gempir•25m ago•0 comments

The IBM PC, Part 1: Arrival

https://technicshistory.com/2026/07/24/the-ibm-pc-part-1-arrival/
3•cfmcdonald•28m ago•0 comments

A For-Profit Path to Keeping Housing Affordable

https://www.nytimes.com/2026/07/24/realestate/for-profit-affordable-housing-ascent.html
4•donohoe•29m ago•1 comments

AI generated PRs can hide malicious intent across several PRs

https://blog.codacy.com/detecting-malicious-intent-across-ai-generated-pull-requests-a-governance...
2•ARayOutOfBounds•32m ago•0 comments

Fraudulent Dialer (Wikipedia)

https://en.wikipedia.org/wiki/Dialer
2•grubbs•32m ago•0 comments

Microsoft pressures LG into killing unwanted McAfee ads

https://www.theverge.com/tech/970489/lg-mcafee-ads-windows-microsoft-crackdown
5•timpera•34m ago•0 comments

I Made the Perfect Outline Asset for Unity

https://assetstore.unity.com/packages/vfx/shaders/outline-pro-edge-detection-outline-for-urp-brp-...
2•Adam-Hincu•35m ago•1 comments

Emergent Misalignment Recruits a Pre-Existing Persona Subspace

https://arxiv.org/abs/2607.21356
2•sbulaev•35m ago•0 comments

Volkswagen CFO addresses plant closures, job losses as profits sink

https://www.cnbc.com/2026/07/24/volkswagen-earnings-autos-germany.html
2•johnbarron•37m ago•0 comments

Two things every MCP author should add

https://medusajs.com/blog/two-things-every-mcp-author-should-add/
3•shahednasser•38m ago•0 comments

Axon, a TypeScript framework for agent development

https://axon.arclabs.it/docs/v2
2•codywakeford•39m ago•0 comments

Gen Z protests in India demanding resignation of Education Minister

https://www.bbc.com/news/videos/c3307vgneveo
3•Guestmodinfo•39m ago•2 comments

Dynamic JS function environments at runtime. Zero deps, total control with Nexus

https://www.npmjs.com/package/nexus-env
2•omid2007hope•40m ago•0 comments

European researchers want to study social media's harms but can't get the data

https://www.wired.com/story/european-researchers-want-to-study-social-medias-harms-but-cant-get-t...
4•joozio•41m ago•0 comments