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?

Dan Murphy's customer information accessed in breach of membership platform

https://www.abc.net.au/news/2026-12-03/dan-murphys-my-dans-customer-information-data-breach/10745...
1•Khaine•6s ago•0 comments

DoorDash says customer data exposed in AI-assisted breach

https://www.cnn.com/2026/12/04/business/doordash-customer-data-breach-ai-hnk
1•1659447091•2m ago•0 comments

Woolworths cyber breach exposes data of 14M customers

https://www.news.com.au/technology/online/hacking/woolworths-cyber-breach-exposes-data-of-14-mill...
2•paid_dot_expert•4m ago•0 comments

Haru-122B-A10B-Preview, a 122B-parameter full-duplex speech-to-speech model

https://www.higurashi.ai/haru122b/
1•jzebedee•8m ago•0 comments

Reverse Engineering a Board Game

https://lobste.buzzing.cc/en/
1•Alex5758•12m ago•0 comments

Halo's New Developer Announced by Activision

https://www.ign.com/articles/halo-new-developer-announced-by-activision-methodical-games
1•extasetoi12•13m ago•0 comments

Keeping HTTPS Connections Safe in Chrome

https://blog.google/security/keeping-https-connections-safe-in-chrome/
2•arwt•16m ago•0 comments

How to Stop Generic Type Explosion in Rust

https://edvong.com/stop-generic-type-explosion/
1•ohmycobol•16m ago•0 comments

The Profound Benefits of Disrupting Your Circadian Rhythm

https://thoughtcurrents.substack.com/p/the-profound-benefits-of-disrupting
1•ohohoho•18m ago•0 comments

With a Counterexample, Mathematicians Show That It's an Unfair World

https://www.quantamagazine.org/
2•Kushvinthe•22m ago•0 comments

MFK Fisher's clandestine campaign to spread Japanese cuisine

https://longreads.com/2026/11/24/mfk-fisher-influencer-japanese-food-america/
1•mooreds•24m ago•0 comments

Former NASA contractor pleads guilty to stealing wheel from moon rover

https://www.cnn.com/2026/12/03/politics/man-pleads-guilty-stealing-wheel-from-moon-rover-viper-nasa
1•mooreds•25m ago•0 comments

This bookseller's loyalties lie with the written word

https://www.cpr.org/2026/12/02/rare-books-feeding-artificial-inteilligence/
2•mooreds•29m ago•0 comments

Amazon tightens safety rules after AI toys teach kids about knives and sex

https://arstechnica.com/ai/2026/12/amazon-tightens-safety-rules-after-ai-toys-teach-kids-about-kn...
3•tech-historian•31m ago•0 comments

Scio – a knowledge library built by AI agents

https://scio.md/
1•lifthrasiir•32m ago•1 comments

Canada may use cyber 'offensive capabilities' after hit to military system

https://www.cbc.ca/news/politics/ai-hack-government-websites-defence-export-control-system-9.7447074
4•geox•38m ago•0 comments

US strategic petroleum reserve is now the lowest in its history

https://twitter.com/RBAdvisors/status/2128509563049582846
4•toomuchtodo•39m ago•1 comments

Woolworths Data Breach (Australia)

https://www.abc.net.au/news/2026-12-04/woolworths-database-hacked-cyber-criminals/107463078
5•MarkBlah•42m ago•3 comments

Elegance and Intelligence Are Anticorrelated

https://www.seangoedecke.com/elegance-and-intelligence-are-anticorrelated/
4•prakashqwerty•45m ago•0 comments

Tell HN: HN search (Algolia) supports exact match using straight quotes only

3•Barbing•47m ago•2 comments

Bumbition

https://www.noahpinion.blog/p/bumbition
2•gmays•51m ago•0 comments

The Riemann Hypothesis for Humans

https://arxiv.org/abs/2612.03144
3•Brajeshwar•54m ago•0 comments

An interactive reading of the leaked Windows XP source code

https://lr0.org/blog/p/winxp/
3•Brajeshwar•54m ago•0 comments

World's largest wildlife crossing opens in Los Angeles

https://www.theguardian.com/us-news/2026/dec/02/los-angeles-bridge-wildlife-crossing
3•blinding-streak•54m ago•0 comments

Interpretability Team Priorities Update

https://transformer-circuits.pub/2026/priorities-update/index.html
1•allenleee•1h ago•0 comments

Germany in ruins: Remaking an 80-year-old map

https://www.datawrapper.de/blog/pie-map-remake-wwii
2•JulieZhao00•1h ago•2 comments

Plain Text Accounting

https://plaintextaccounting.org/
2•saikatsg•1h ago•0 comments

Silicon Valley, is this your king?

https://www.theverge.com/ai-artificial-intelligence/1050049/jensen-huang-disastrous-performance-c...
15•aanet•1h ago•1 comments

Harness Tricks for Coding Agents on Local Models with Small Context Windows

https://blog.wiseprobe.io/posts/harness-tricks-small-context-local-models/
1•wiseprobe•1h ago•1 comments

A solution to AlphaGenome 2's indel offset: ranking SNVs and indels together

https://aleksandarstalevski.github.io/alphagenome2-indel-offset-solution/
2•rtmkrptn•1h ago•1 comments