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?

Self-Serve Drill Bits Are a CIAM Use Case

https://ciamweekly.substack.com/p/self-serve-drill-bits-are-a-ciam
1•mooreds•59s ago•0 comments

Surreal UbuWeb has been 'tocked

https://nonsens.ing/ubutok/
1•a_number_of_his•2m ago•1 comments

Mars dust may be less abrasive than lunar dust, spacesuit samples suggest

https://phys.org/news/2026-10-mars-abrasive-lunar-spacesuit-samples.html
1•bookmtn•2m ago•0 comments

The Megadonors Who Have Poured $1.2B into the Midterms

https://www.nytimes.com/interactive/2026/08/28/us/politics/billionaire-midterms-donors.html
1•doener•4m ago•0 comments

Should He Fix Churn, Change Pricing, or Rebuild His SaaS? [video]

https://www.youtube.com/watch?v=uTVyLYDOd1M
1•mooreds•4m ago•0 comments

Cozy random passages from Arnold Lobel's Frog and Toad books

https://bsky.app/profile/frogandtoadbot.bsky.social
1•mooreds•6m ago•0 comments

Google joins OpenAI and Anthropic in promising new scraping controls

https://www.engadget.com/2303225/google-openai-anthropic-ai-crawling-controls/
1•geox•11m ago•0 comments

The Exponential Time Hypothesis: How the (dis-)proof works [video]

https://www.youtube.com/watch?v=fEaTKrk492E
1•HotHotLava•18m ago•1 comments

NASA is asking for ideas to rescue Hubble

https://arstechnica.com/space/2026/10/think-you-can-save-the-hubble-space-telescope-nasa-wants-to...
1•Gaishan•19m ago•0 comments

In LLM era, can software startup survive?

3•sjia•22m ago•2 comments

Nashi: Open-source file converter and editor app with a drag-wheel interaction

https://github.com/orkunisitmak/nashi-app
1•thunderbong•23m ago•0 comments

Bell Labs Contribution to the Architecture of Computation Theory

https://en.wikipedia.org/wiki/Point-contact_transistor
1•efren6•23m ago•0 comments

U.S. workers took home their smallest share of capital since at least 1947

https://fortune.com/article/why-did-us-workers-just-take-home-smallest-share-of-capital-since-194...
71•qlte•30m ago•11 comments

Its Investors Say Kalshi Is Worth $40B. Is an IPO Next?

https://www.nytimes.com/2026/10/29/business/dealbook/kalshi-fundraising-ipo.html
1•bookofjoe•30m ago•1 comments

America's Sewer Systems Are Surprisingly Vulnerable to Cyber Attacks

https://policygradients.thefai.org/p/americas-sewer-systems-are-surprisingly
3•donchuru•31m ago•0 comments

France plans internet tax of 5.5 cents per gigabyte

https://www.heise.de/en/news/France-plans-internet-tax-of-5-5-cents-per-gigabyte-11507179.html
3•slymax•33m ago•0 comments

Ask HN: What do you predict you'll be doing for work in 5 years?

2•thedreammachine•34m ago•1 comments

Show HN: TunaML – Renewable Energy Analytics

https://tunaml.com/
1•sheunl•36m ago•0 comments

AI Nerfs: Are Claude, ChatGPT, and Gemini Nerfed Today?

https://ai-nerfs.com
1•MaxDevv•37m ago•0 comments

Show HN: My Sports OS – A platform for sports scientists, teams, and coaches

https://mysportsos.com/
1•mysportsos•40m ago•0 comments

Nine ways to break your systems code using volatile (2010)

https://blog.regehr.org/archives/28
1•andsoitis•43m ago•0 comments

Made-of-meat, a listserv for agentic eng practitioners

https://mom-hub.tryapexti.ai/
1•asah•43m ago•1 comments

Why are car keys so expensive to replace?

https://thehustle.co/originals/why-are-car-keys-so-expensive-to-replace
2•rmason•45m ago•0 comments

Stackless Python is an enhanced version of the Python programming language

https://github.com/stackless-dev/stackless/wiki/
1•Bluestein•45m ago•0 comments

Cited by AGI

https://citedbyagi.com/
2•gone35•45m ago•0 comments

A Guide to Undefined Behavior in C and C++

https://blog.regehr.org/archives/213
1•andsoitis•46m ago•0 comments

Show HN: A faster Python 3 interpreter implemented in C11, one week

1•soasme•51m ago•0 comments

Human-Pilled – The Bitter Lesson Meets Architectures of Participation

https://asimovaddendum.substack.com/p/human-pilled
1•rmason•56m ago•0 comments

CVE-2026-Solitaire:Windows Free Bundling Causing Global Productivity Loss

https://medium.com/@saitoken330/cve-2026-solitaire-critical-vulnerability-in-microsoft-windows-fr...
2•7kago_yomi•58m ago•0 comments

Empires of AI – By Eric Schmidt and Niall Ferguson

https://www.foreignaffairs.com/china/empires-artificial-intelligence-niall-ferguson-eric-schmidt
3•ksajadi•58m ago•1 comments