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?

CRTs and other ewaste can no longer be exported from the USA

https://twitter.com/techknight2/status/2085434346501001668
1•tosh•2m ago•0 comments

The AI slowdown is coming

https://www.transformernews.ai/p/the-ai-slowdown-is-coming
1•reasonableklout•4m ago•0 comments

The Event of 2033 – An AI-Imagined Second Coming

https://www.amazon.com/dp/B0HCN65Q57
1•aimasterpiece•9m ago•0 comments

90 second power loss causing second day of train disruption

https://www.bbc.co.uk/news/live/cwy0d0wgy4xt
2•rwmj•14m ago•1 comments

Why and how the Austrian Military moved to LibreOffice (Part 1)

https://blog.documentfoundation.org/blog/2026/08/07/why-and-how-the-austrian-military-moved-to-li...
3•mksaunders2•15m ago•0 comments

DeepSeek V4 Flash 0731: Is It Cheaper to Run It at Home or Pay per Token?

https://grigio.org/deepseek-v4-flash-0731-is-it-cheaper-to-run-it-at-home-or-pay-per-token/
1•grigio•16m ago•1 comments

All memory manufactured in 2027 has been sold out

https://www.ign.com/articles/ramageddon-continues-another-year-as-2027-memory-capacity-is-reporte...
1•inigyou•16m ago•0 comments

Is your Bitcoin seed safe after Coldcard accident? What about iancoleman/bip39?

https://grigio.org/is-you-bitcoin-seed-safe-after-coldcard-accident-what-about-iancoleman-bip39/
1•grigio•17m ago•1 comments

Truckslop

https://truckslop.joshu.dev/
1•tosh•17m ago•0 comments

Marque Terminal

https://marque.at/download
1•scanash00•19m ago•0 comments

The Ones Who Look Outward

https://www.centauri-dreams.org/2026/08/06/the-ones-who-look-outward/
1•JPLeRouzic•21m ago•0 comments

Tsang Tsou-Choi

https://en.wikipedia.org/wiki/Tsang_Tsou-choi
1•bondarchuk•23m ago•0 comments

Show HN: Remembrane – agent memory in one SQLite file, zero dependencies

https://github.com/satyasairay/remembrane
3•satyasairay•23m ago•0 comments

Windows Tracks You with Hidden ID. We Built DeGDID to Block It

https://windscribe.com/blog/windows-tracks-you-with-a-hidden-id-so-we-built-degdid-to-block-it/
1•defrost•24m ago•0 comments

AI model achieves breakthrough in forecasting cyclones – Google DeepMind

https://deepmind.google/blog/weathernext-ai-model-achieves-breakthrough-in-forecasting-cyclones/
1•rbanffy•25m ago•0 comments

Operational Tropical Cyclone Forecasting with AI – Nature

https://www.nature.com/articles/s41586-026-10953-2
1•rbanffy•25m ago•0 comments

Don't get rejected by Apple anymore

https://www.apprejectkit.com/guides/app-store-submission-checklist/
1•jonvolio•26m ago•0 comments

Show HN: CapyToolkit – Browser-native developer and hardware diagnostic tools

https://capytoolkit.com/
1•ChillyCapy•27m ago•0 comments

High-Quality Free Transparent PNG Collections

https://pngdex.com/collections/
1•kanlabs•27m ago•0 comments

I won't read LLM authored fiction

https://mccormick.cx/news/entries/why-i-won-t-read-llm-authored-fiction
2•chr15m•28m ago•0 comments

The offline messaging apps challenging internet shutdowns

https://restofworld.org/2026/india-github-geoblock-jack-dorsey-bitchat/
4•billybuckwheat•29m ago•0 comments

Ask HN: DeepSeek Alternatives

1•bndr•31m ago•0 comments

Ask HN: After 20 years of coding it is not a fun hobby anymore. How about you?

1•alex_x•31m ago•1 comments

Russian spy 'honeytraps' lure Ukrainian soldiers to their deaths

https://www.thetimes.com/world/europe/article/russia-spy-ukraine-death-honeytrap-kbm55pcl7
1•petethomas•32m ago•0 comments

Ball Scratch Simulator: release date, gameplay, VR, and PC requirements

https://ballscratchsimulator.wiki/
1•visiohex•32m ago•1 comments

Passkeys by default and retirement of Microsoft SMS and voice authentication

https://www.microsoft.com/en-us/security/blog/2026/07/13/microsoft-entra-id-security-updates-pass...
1•firefoxd•37m ago•0 comments

How to read the Attention formula from the Attention is all you need paper

https://twitter.com/i/status/2085629807656862037
1•asxndu•38m ago•0 comments

Americans Are Richer Than Everyone Else

https://www.cremieux.xyz/p/americans-are-richer-than-everyone
1•NewCzech•39m ago•1 comments

INT2 KV-cache quantization is getting surprisingly good

https://arxiv.org/abs/2608.02691
1•yunuyean•41m ago•0 comments

Canadian imports for data centre equipment up 88% from prior year

https://www.theglobeandmail.com/business/article-data-centre-equipment-imports-ai-boom-canada/
1•petethomas•43m ago•0 comments