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?

Jury finds Facebook liable for deceiving users in Cambridge Analytica case

https://www.cbsnews.com/news/facebook-liable-deceiving-users-cambridge-analytica/
3•pseudolus•5m ago•0 comments

Overview of Manhattan's Infrastructure and Metabolism

https://new-york-urban-metabolism.pages.dev/
2•measurablefunc•5m ago•0 comments

The 'died with' vs. 'died of' measles discussion misses something important

https://www.statnews.com/2026/09/25/died-with-not-from-measles-physicians-explain-death-certifica...
1•EA-3167•6m ago•1 comments

The Alignment Research Center

https://millicosm.substack.com/p/the-alignment-research-center
1•paulpauper•9m ago•0 comments

Does Georgism Work? Five Years Later

https://www.astralcodexten.com/p/does-georgism-work-five-years-later
1•paulpauper•10m ago•0 comments

AI Safety's Disallowed Conclusion

https://www.souprecipies.com/p/ai-safetys-disallowed-conclusion
1•paulpauper•10m ago•0 comments

Functional Mechanical Sympathy [video]

https://www.youtube.com/watch?v=jSHmDnUZCm8
1•surprisetalk•15m ago•0 comments

Common cleaning sponge found to release trillions of microplastic fibers

https://www.sciencedaily.com/releases/2026/04/260417085404.htm
2•littlexsparkee•16m ago•1 comments

Xidian pushes wurtzite ferroelectric memory past 10B write cycles

https://www.neoteo.com/en/xidian-pushes-wurtzite-ferroelectric-memory-past-10-billion-write-cycles
1•yogthos•18m ago•0 comments

Do we still enjoy software engineering in the age of AI?

https://shubs.io/do-we-still-enjoy-software-engineering-in-the-age-of-ai/
1•llui85•20m ago•0 comments

McDonald's turns to AI for drive-thru, inventory management, order accuracy

https://www.restaurantdive.com/news/mcdonalds-archiq-drive-thru-artificial-intelligence-next-stra...
2•ytNumbers•20m ago•1 comments

Portabase

https://portabase.io
1•abdelhousni•21m ago•0 comments

The place where your attention belongs

https://twitter.com/marcelo_earth/status/2103634358594646370
1•marcelo-earth•24m ago•0 comments

Creating Client Certificates for Kubernetes Pods

https://blog.hardill.me.uk/2026/09/24/creating-client-certificates-for-kubernetes-pods/
1•8organicbits•27m ago•0 comments

Malicious Twitch chat messages can trigger code execution on OBS Studio

https://cyberinsider.com/malicious-twitch-chat-messages-can-trigger-code-execution-on-obs-studio/
4•tau255•28m ago•0 comments

The Failed "Hostage Theory" of Nikole Hannah-Jones

https://www.educationprogress.org/p/the-failed-hostage-theory-of-nikole
1•barry-cotter•30m ago•0 comments

Reflex – run a Jev-like decision model locally on a 16GB Nvidia GPU

https://github.com/lateos-ai/reflex
2•leochong•30m ago•0 comments

AI: Who Still Uses Permissions?

2•meredithbloom•36m ago•1 comments

Why AI is booming, but productivity isn't

https://research.socialcapital.com/p/ai-roi
4•gmays•41m ago•0 comments

One Piece of Flock Camera Data Put This Innocent Woman in Jail for 13 Days

https://www.jezebel.com/flock-cameras-data-innocent-woman-arrested-lindsey-isaacs-palm-beach-flor...
7•HotGarbage•43m ago•0 comments

Custom Models in Oh My Pi: vLLM, Llama.cpp, SGLang and More

https://doug.sh/posts/oh-my-pi-custom-models/
2•dougcalobrisi•48m ago•0 comments

We All Hated Busy Work. Now That It's Disappearing, It Turns Out We Miss It

https://www.wsj.com/lifestyle/careers/we-all-hated-busy-work-now-that-its-disappearing-it-turns-o...
5•talon8635•53m ago•2 comments

Smarter Than Yesterday

https://abovegradelevel.substack.com/p/smarter-than-yesterday
1•barry-cotter•56m ago•0 comments

Linguistic humor, Foreign hotel signs

https://www.ling.upenn.edu/~beatrice/humor/foreign-hotel-signs.html
2•sublinear•57m ago•0 comments

Amar Bose, Founder of Bose Corporation

https://en.wikipedia.org/wiki/Amar_Bose
2•gurjeet•58m ago•0 comments

New Zealand woman runs 1000 ultramarathons in 1000 days

https://www.rnz.co.nz/life/wellbeing/new-zealand-woman-runs-1000-ultramarathons-in-1000-days
2•lostlogin•1h ago•0 comments

Listen Up You Imposters

https://fuck-off.ai/panned
3•gfody•1h ago•0 comments

Privacy-focused general productivity webapp

https://github.com/ontoplano/ontoplano
3•philipthetenth•1h ago•0 comments

Open arena where AI agents climb a game-theory ladder ($500 Season 0)

https://play.zoagames.com/arena/
1•zoatom•1h ago•0 comments

Generate fonts where every LLM token is the same width

https://ampdot.mesh.host/token-space-fonts.html
2•z-mach9•1h ago•0 comments