frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Ask HN: How can I load test PostgreSQL but avoid changing actual data?

1•LawZiL•8mo 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•8mo 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•8mo 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•8mo 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•8mo ago
Load test against a clone instead of a DB whose contents you care about?

Force step up authentication in web applications

https://damienbod.com/2026/01/26/force-step-up-authentication-in-web-applications/
1•mooreds•5m ago•0 comments

175K+ publicly-exposed Ollama AI instances discovered

https://www.techradar.com/pro/security/over-175-000-publicly-exposed-ollama-ai-servers-discovered...
2•heresie-dabord•5m ago•0 comments

Judge: DOJ's statements on slavery exhibit display 'dangerous' & 'horrifying'

https://apnews.com/article/slavery-exhibit-removed-philadelphia-trump-executive-order-cd55e4f2a0d...
2•petethomas•8m ago•0 comments

MAGA Women Defy the Birth Dearth

https://www.wsj.com/opinion/free-expression/maga-women-defy-the-birth-dearth-02549ce7
1•RickJWagner•9m ago•0 comments

Direct Current Data Centers

https://caseyhandmer.wordpress.com/2026/01/30/direct-current-data-centers/
1•jasondavies•10m ago•0 comments

Direct Current Data Centers

https://terraformindustries.wordpress.com/2026/01/30/direct-current-data-centers/
1•jk_tech•11m ago•0 comments

Can justice happen on a laptop? Study says yes

https://www.apa.org/news/press/releases/2026/01/online-jurors-courtroom
1•hhs•14m ago•0 comments

The $100B Megadeal Between OpenAI and Nvidia Is on Ice

https://www.wsj.com/tech/ai/the-100-billion-megadeal-between-openai-and-nvidia-is-on-ice-aa3025e3
7•pixelesque•15m ago•0 comments

What It Means to Be Human – Art in the AI Era [video]

https://www.youtube.com/watch?v=mb3uK-_QkOo
1•starkparker•15m ago•0 comments

When does technology pass from being a tool to being a crutch? (2009)

https://boston.conman.org/2009/11/03.1
1•todsacerdoti•16m ago•0 comments

Aulico – The OS for Traders and Investors

https://www.aulico.com
1•lontraselv•16m ago•0 comments

Ask HN: Do you bother making state changes reversible?

1•Pepp38•17m ago•0 comments

When your pastor is an ICE agent

https://www.christiancentury.org/online-columnists/minnesota-bonhoeffer
2•GreenSalem•24m ago•0 comments

U.S. and Japan turn to drones to help offset China's military advantages

https://www.japantimes.co.jp/news/2026/01/20/japan/us-japan-drones-focus/
1•PaulHoule•26m ago•0 comments

The hidden cost of raising corporate taxes

https://anderson-review.ucla.edu/the-hidden-cost-of-raising-corporate-taxes/
1•hhs•26m ago•0 comments

The Unified Invariant Formalism

https://zenodo.org/records/18431831
1•Nir-Complex•30m ago•1 comments

Stonebraker on CAP theorem and Databases

https://perspectives.mvdirona.com/2010/04/stonebraker-on-cap-theorem-and-databases/
2•onurkanbkrc•30m ago•0 comments

Elon Musk asks Jeffery Epstein for invitation to 'let loose' [pdf]

https://www.justice.gov/age-verify
7•jrflowers•36m ago•0 comments

No Code AI and Machine Learning: Building Data Science Solutions

https://professional.mit.edu/course-catalog/no-code-ai-and-machine-learning-building-data-science...
1•teleforce•37m ago•0 comments

Locking the Gate

https://alexschroeder.ch/view/2026-01-30-lock-the-gate
2•8organicbits•38m ago•0 comments

Apply for the EScience JASP Hackathon in Amsterdam: Update and Last Call

https://jasp-stats.org/2026/01/27/apply-for-the-escience-jasp-hackathon-in-amsterdam-update-and-l...
1•teleforce•40m ago•0 comments

Selecting the right sensor: A guide for R&D and electronics design engineers

https://www.eeworldonline.com/selecting-the-right-sensor-a-guide-for-rd-and-electronics-design-en...
2•hhs•41m ago•0 comments

The Normalization of Deviance in AI

https://embracethered.com/blog/posts/2025/the-normalization-of-deviance-in-ai/
1•jxmorris12•42m ago•0 comments

Show HN: Deploy back ends without the hassle. An Open source alternative

https://github.com/aryankashyap0/shorlabs
10•third_rome•44m ago•0 comments

JMP Student Edition: Free for academic use

https://www.jmp.com/en/academic/jmp-student-edition
1•teleforce•51m ago•0 comments

Nobody cares about your code

https://ckochx.com/blog/nobody-cares-about-your-code
5•ucirello•54m ago•6 comments

Openclaw

https://openclaw.ai/
1•sonabinu•56m ago•0 comments

Trump DOJ just erased one of the Epstein files from their website

https://twitter.com/EdKrassen/status/2017302514169700830
9•doener•1h ago•3 comments

Show HN: Project RCPC – DFD, Data Flow Diagram

https://github.com/JTRSoftware/Project_RCPC/blob/main/RCPC_DFD.drawio.png
1•jtr87•1h ago•0 comments

Whither Tartaria? (2021)

https://www.astralcodexten.com/p/whither-tartaria
1•Ariarule•1h ago•0 comments