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?

Exe.dev Fan Site

https://exe-muttha-fukken-dev.exe.xyz
1•indigodaddy•4m ago•0 comments

Scientists find cannabis terpenes (geraniol) relieve chronic pain without a high

https://www.sciencedaily.com/releases/2026/06/260619033343.htm
1•ck2•5m ago•1 comments

Would you leave your car and hop into a flying taxi?

1•kyokoL•12m ago•2 comments

APL Keyboard on iOS

https://github.com/ebanner/apl-keyboard/tree/main
1•meken•14m ago•0 comments

Show HN: Wind particles on Mapbox from a single EXIF JPEG

https://www.us-wind-particle-map-demo.mapbox-exif-layer.com
1•zifanw9•14m ago•0 comments

PostgreSQL Zero-Downtime Migration: On-Prem to AWS Cloud

https://github.com/JoeyAlpha5/postgres-on-prem-aws-cloud-migration
1•sunbirdLabs•14m ago•0 comments

Show HN: Core Rankings for DBLP Profiles

https://pubtier.com/
1•otrack•17m ago•0 comments

PRs and LLMs

https://gerdzellweger.com/engineering/2026/06/27/prs-and-llms.html
2•gz09•20m ago•0 comments

The feature in OxCaml that more languages should steal

https://theconsensus.dev/p/2026/06/27/the-feature-in-oxcaml-more-languages-should-steal.html
2•g0xA52A2A•23m ago•0 comments

NASA: Explore El Niño

https://science.nasa.gov/earth/explore/el-nino/
1•karakoram•26m ago•0 comments

Apple wants permission to buy memory from a blacklisted Chinese supplier

https://www.theverge.com/tech/958707/apple-ram-buy-memory-blacklisted-china-cxmt
2•ilreb•27m ago•1 comments

Koreeda's 'Sheep in the Box': The ethics of AI resurrection in film

https://www.nippon.com/en/japan-topics/c030329/
1•whiteblossom•29m ago•0 comments

Engineers Cram 100B Transistors onto a Microchip

https://www.science.org/content/article/engineers-cram-100-billion-transistors-microchip
1•karakoram•29m ago•0 comments

The Card That Made the Apple II Serious

https://www.wiseowl.com/articles/a2fpga-videx-01-the-card-that-made-the-apple-ii-serious/
2•js2•29m ago•0 comments

NestJS and Angular SaaS Starter Kit (MIT)

https://github.com/sayahweb2-png/saas-starter-lite
1•firas_sayah•32m ago•0 comments

The abundant but expensive energy source that's under your feet

https://www.bbc.com/news/articles/cj3gj1n8yz8o
1•ksec•32m ago•0 comments

Department of Machine Verification

https://departmentofmachineverification.com/
1•nembal•34m ago•0 comments

Heat Wave in Europe Shatters Records in Denmark, Switzerland and Czech Republic

https://www.cbc.ca/news/world/europe-heatwave-2026-temperature-records-broken-9.7251458
2•runeks•36m ago•0 comments

Chinese Hedge Funds Warn the AI 'Super Bubble' Is Ready to Burst

https://www.bloomberg.com/news/articles/2026-06-26/chinese-hedge-funds-warn-the-ai-super-bubble-i...
2•aggrrrh•39m ago•1 comments

Resilient Minds

https://unesdoc.unesco.org/ark:/48223/pf0000394849
2•jruohonen•42m ago•0 comments

How we made parallel pytest safe for multi-tenant agent swarms

https://equatorops.com/resources/blog/parallel-pytest-agent-swarms
1•bobjordan•42m ago•0 comments

How Europe Became the World Champion of Heat Deaths

https://maartenboudry.substack.com/p/how-europe-became-the-world-champion
4•paulpauper•43m ago•0 comments

Ancient Tablets Show Markets Worked 4k Years Before Economists Explained Them

https://thedailyeconomy.org/article/ancient-clay-tablets-show-markets-worked-4000-years-before-ec...
1•paulpauper•43m ago•0 comments

Do Not Rule Out What Scares You [video]

https://andreagibson.substack.com/p/commencement
1•mooreds•53m ago•0 comments

CarvePHP – Find service boundaries in Laravel monoliths

https://packagist.org/packages/carvephp/carve
1•mwaleedkhalil•54m ago•0 comments

Social Structure and Anomie [pdf]

https://selfteachingresources.pbworks.com/f/Social+Structure+and+Anomie+-+Merton.pdf
1•jruohonen•58m ago•0 comments

Judgment Cannot Be Prompted

https://www.tsoon.com/posts/judgment-cannot-be-prompted/
2•mooreds•58m ago•0 comments

Traditions of Islantilla

https://www.islantilla.es/en/tradiciones/
1•mooreds•59m ago•0 comments

Gavin Newsom opposes a California wealth tax. He's proposing a national tax

https://www.cnn.com/2026/06/26/politics/gavin-newsom-billionaire-tax-california
2•Bender•1h ago•3 comments

Napster is now "AI agents you can see, talk to, and create with."

https://www.napster.com
2•romanhn•1h ago•2 comments