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?

OpenAI 2025 financials $38.5B loss ahead of IPO

https://qz.com/openai-leaked-financials-losses-revenue-ipo-061626
1•u1hcw9nx•1m ago•0 comments

ACX Review Archive

https://acxreviews.robennals.org/
1•altilunium•5m ago•0 comments

DIYing Apps for Fun and Profit

https://www.fldr.zip/blog/diying-apps-for-fun-and-profit
1•wyxuan•8m ago•0 comments

Escaping Containment

1•silexia•9m ago•0 comments

Switzerland's Federal Government Is Replacing Microsoft on 3k Computers

https://itsfoss.com/news/switzerland-replace-microssoft-pilot/
1•ivell•9m ago•1 comments

The City and the City

https://en.wikipedia.org/wiki/The_City_%26_the_City
2•debo_•18m ago•0 comments

Volkswagen to cut 50k more jobs, hitting 100k total layoffs

https://qz.com/volkswagen-job-cuts-100000-future-plan-2030-090426
2•backlit4034•18m ago•0 comments

Nvidia's Jensen Huang says 'AGI has arrived' and congratulates OpenAI

https://www.businessinsider.com/nvidia-jensen-huang-agi-openai-astra-ai-2026-9
7•vinni2•19m ago•5 comments

Sanctioned ICC head calls court the last bastion of rule of law

https://www.japantimes.co.jp/news/2026/09/07/japan/akane-icc-last-bastion-rule-law/
1•anigbrowl•20m ago•0 comments

OpenAI Computer Using Agent Sample App

https://github.com/openai/openai-cua-sample-app
1•helloplanets•22m ago•0 comments

India's alternative-fuel car sales top petrol on cost, E20 concerns

https://www.reuters.com/world/india/indias-alternative-fuel-car-sales-top-petrol-cost-e20-concern...
2•geox•22m ago•0 comments

Long-term melatonin use linked to 90% higher heart failure risk

https://www.sciencedaily.com/releases/2026/08/260829035228.htm
2•chasil•22m ago•1 comments

Ask HN: Open-source AI policies and "responsbility"

1•noobermin•23m ago•0 comments

AI Index Report

https://hai.stanford.edu/ai-index/2026-ai-index-report
2•olalonde•27m ago•0 comments

Ask HN: Resources for how to get good at sales

1•nomilk•29m ago•0 comments

Bot Detection Without JavaScript: What My Blog Measured

https://gkoreli.com/how-i-separate-readers-from-bots-without-javascript
2•gogakoreli•29m ago•0 comments

I wrote a lighthearted guide to learning Monads – maybe you like

https://github.com/ManuelSaleta/CavemanProgramming/blob/main/Monads/README.md
1•signa11•32m ago•0 comments

Responsive Text and Code

https://unsung.aresluna.org/responsive-text-and-code/
3•srijan4•35m ago•1 comments

Will anybody use AI as much as coders do?

https://www.economist.com/business/2026/08/30/will-anybody-use-ai-as-much-as-coders-do
3•nialse•39m ago•1 comments

DJCJ Arcade – MAME front end for MacOS

https://github.com/DJCJ-website/DJCJArcade
2•chriscjcj•45m ago•1 comments

Google Compute shut down my server for distributing malware

2•farzher•51m ago•0 comments

Show HN: Engrim – A universal, local-first SQLite memory engine for AI CLIs

https://github.com/timgordontg/engrim
3•timgordontg•53m ago•0 comments

TiVo to charge money for skipping commercials in your own recordings

https://cordcuttersnews.com/tivo-plans-to-end-free-automatic-commercial-skipping-in-november-test...
5•dmitrygr•1h ago•0 comments

Show HN: The Duck Has WiFi, a music video drawn with Python

https://www.youtube.com/watch?v=_h1KgS169iM
3•modinfo•1h ago•0 comments

HPE Gives Oracle Right to Buy 4.2M Shares for 1 Cent Each

https://www.forbes.com/sites/antoniopequenoiv/2026/09/03/hewlett-packard-enterprise-gives-oracle-...
7•gurjeet•1h ago•0 comments

I refused to train the AI that could replace me

https://restofworld.org/2026/ai-training-jobs-expert-replacement/
9•colinprince•1h ago•0 comments

The Instinct Thesis: Why Memory Is Becoming the Moat

https://twitter.com/ashwingop/status/2093026452929405356
2•yarapavan•1h ago•0 comments

Marginal Revolution University: Economics for Everyone,taught by econ professors

https://mru.org
2•gurjeet•1h ago•0 comments

I just don't care about your skill files

2•drunkpotato•1h ago•1 comments

From NAND to Tetris (book and course) [video]

https://www.youtube.com/watch?v=LqirVc5SlW0&list=PLrDd_kMiAuNmSb-CKWQqq9oBFN_KNMTaI
3•nomilk•1h ago•1 comments