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

Fine-Tuning Large Language Models LLMs with a Production-Grade Pipeline (2023)

https://alex000kim.com/posts/2023-09-08-finetune-llm-pipeline-dvc-skypilot/
1•teleforce•1m ago•0 comments

Leapstack-vn-data-breach-approximately-100-GB-of-health-insurance-claims

https://medium.com/@infosec_chu/leapstack-vn-data-breach-approximately-100-gb-of-health-insurance...
1•tryee•3m ago•0 comments

The Technocracy Movement of the 1930s

https://donotresearch.substack.com/p/welcome-to-the-technocracy
2•lazydogbrownfox•4m ago•0 comments

Period – 11M params car parking model

https://therefore.sh/projects/period
1•LorenDB•4m ago•0 comments

'A System Rigged': Untaxed Wealth of Richest 0.1% More Than Poorest Half

https://www.commondreams.org/news/global-tax-havens-inequality
2•ZunarJ5•7m ago•0 comments

EPA Targets Microplastics and Drugs in Drinking Water

https://www.nytimes.com/2026/04/02/climate/microplastics-maha-epa.html
1•lxm•7m ago•0 comments

Jobs Being Created by AI

https://www.wsj.com/tech/ai/wanted-head-of-human-ai-solutions-the-new-jobs-being-created-by-ai-87...
2•Jimmc414•7m ago•0 comments

Can I say, "Thank You"?

2•ghastmaster•9m ago•0 comments

A tool to help product write better specs

https://www.clearspec.dev
1•mikopiko•11m ago•0 comments

The Unreasonable Effectiveness of Cash Transfers

https://nicholasdecker.substack.com/p/the-unreasonable-effectiveness-of
1•paulpauper•11m ago•0 comments

How to Mirror from Sourcehut to GitHub

https://timharek.no/blog/mirror-sourcehut-to-github/
1•netule•22m ago•0 comments

Every dependency you add is a supply chain attack waiting to happen

https://benhoyt.com/writings/dependencies/
4•signa11•24m ago•0 comments

Rancho Gordo trademarks 'bean club,' tells others to stop using it

https://www.sfchronicle.com/food/article/rancho-gordo-bean-club-trademark-22071347.php
1•littlexsparkee•24m ago•0 comments

Axios Maintainer Confirms Social Engineering Attack Behind NPM Compromise

https://socket.dev/blog/axios-maintainer-confirms-social-engineering-behind-npm-compromise
2•feross•25m ago•0 comments

The FusionAuth Brainf* SDK

https://fusionauth.io/blog/april-fools-brainf
1•mooreds•26m ago•0 comments

Run a Local LLM, and discover why LLMs are unpredictable

https://newsletter.bphogan.com/archive/issue-51-run-a-local-llm-and-discover-why-llms/
1•mooreds•27m ago•0 comments

The open web isn't dying. We're killing it

https://ouvre-boite.com/the-open-web-isnt-dying-were-killing-it/
1•benwerd•28m ago•0 comments

Tesla March car registrations soar in key European markets

https://www.reuters.com/business/retail-consumer/tesla-french-car-registrations-triple-march-2026...
3•havaloc•31m ago•0 comments

How to Set Up Work and Personal Git Profiles

https://alex000kim.com/posts/2025-07-25-git-profiles/
1•teleforce•33m ago•0 comments

Slightly safer vibecoding by adopting old hacker habits

http://addxorrol.blogspot.com/2026/03/slightly-safer-vibecoding-by-adopting.html
1•transpute•40m ago•0 comments

Help on Posts

1•kvntrnz•44m ago•0 comments

Neoen to Build France's Largest Battery Amid Strained Power Grid

https://www.bloomberg.com/news/articles/2026-04-02/neoen-to-build-france-s-largest-battery-amid-s...
1•toomuchtodo•44m ago•1 comments

Artemis II commander enters tablet PIN on launch livestream

https://nypost.com/2026/04/02/us-news/artemis-ii-commander-enters-tablet-pin-on-launch-livestream...
1•wslh•47m ago•1 comments

Pinterest and Shopmy for AI-powered fashion shopping

https://faishion.ai
1•lucashe•50m ago•1 comments

All the Worst People Seem to Want to Be 'High Agency'

https://www.nytimes.com/2026/04/01/opinion/high-agency-silicon-valley.html
2•bonefishgrill•52m ago•0 comments

Pay to PrAI: Insert Coin to Try Again Podcast

https://www.macrovoices.com/1511-macrovoices-526-matt-barrie-pay-to-prai
1•mattbarrie•55m ago•1 comments

Making TinyLLM Go Brrrrr

https://vinayak.purelydysfunctional.com/blog/KVCache
2•murd3rbot•1h ago•0 comments

Paul Graham, Founder Y Combinator [video]

https://www.youtube.com/watch?v=2Q2uh1BlqKA
2•guiambros•1h ago•0 comments

Timeline of Microsoft's SmartNIC Tech (Azure Boost)

https://glennklockwood.com/garden/Azure-SmartNIC
2•WarOnPrivacy•1h ago•0 comments

Mars Terraforming Research Roadmap

https://arxiv.org/abs/2604.02242
2•edwinkite•1h ago•1 comments