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

HTML Changes in ePub

https://htmhell.dev/adventcalendar/2025/11/
1•robin_reala•33s ago•0 comments

Show HN: Video Frame Extractor – Extract frames in the browser

https://www.blurimageonline.com/video-frame-extractor
1•teroquyiqwu•39s ago•0 comments

Dedicated GPU Server from Hetzner

https://www.hetzner.com/dedicated-rootserver/matrix-gpu/
2•Scotrix•5m ago•1 comments

The ivory tower of Platform Engineering

https://platformengineering.org/blog/the-ivory-tower-of-platform-engineering
1•gpi•6m ago•0 comments

On-Prem Backup Still Makes Sense

https://medium.com/@justinwang001/why-on-prem-backup-still-makes-sense-5723504c2d7b
3•jerrywjh•9m ago•0 comments

Exploration of basic human values in 38 million obituaries over 30 years [pdf]

https://moralitylab.bc.edu/wp-content/uploads/sites/192/2025/09/markowitz-et-al-an-exploration-of...
2•sipofwater•15m ago•1 comments

LLM-Powered Relevance Assessment for Pinterest Search

https://medium.com/pinterest-engineering/llm-powered-relevance-assessment-for-pinterest-search-b8...
1•tsenturk•20m ago•0 comments

The Cost of a Closure in C

https://thephd.dev/the-cost-of-a-closure-in-c-c2y
1•ingve•21m ago•0 comments

We are in the era of Science Slop (and it's exciting)

https://superposer.substack.com/p/we-are-in-the-era-of-science-slop
2•stared•23m ago•0 comments

Show HN: DailyMe–I built an RPG task tracker for ADHD son build self-disclpline

https://dailyme.app/
3•nananono•24m ago•1 comments

Beyond the FGC-9: How the Urutau Redefines the Global 3D-Printed Firearms

https://gnet-research.org/2025/01/08/beyond-the-fgc-9-how-the-urutau-redefines-the-global-3d-prin...
1•f1shy•29m ago•0 comments

Project Chrono an Open Source Multi-Physics Simulation Engine

https://projectchrono.org/
3•lorenzohess•34m ago•0 comments

What I Look for in AI-Assisted PRs

https://benjamincongdon.me/blog/2025/12/10/What-I-Look-For-in-AI-Assisted-PRs/
1•ingve•35m ago•0 comments

Show HN: Browser-based encryption tools with zero server-side processing

https://ikrypt.com/
1•digi_wares•35m ago•0 comments

Show HN: RequestHunt – Find real feature requests from Reddit, X, and HN

https://www.requesthunt.com/
2•Zephyr0x•38m ago•0 comments

You Cannot Fix Rotten Soil

https://alifeengineered.substack.com/p/you-cannot-fix-rotten-soil
3•gpi•41m ago•1 comments

Pick a door. I'll judge you

https://nathanpmyoung.substack.com/p/pick-a-door-ill-judge-you
4•mparramon•41m ago•0 comments

Jetbrains Fixes 20 Year Old Feature Request

https://youtrack.jetbrains.com/issue/CPP-4141/Make-CLion-available-as-IntelliJ-plugin
2•krisgenre•42m ago•0 comments

A new way to see and control your algorithm

https://about.instagram.com/blog/announcements/reels-algorithm-control
1•ChrisArchitect•42m ago•0 comments

Handling Email in Emacs

https://stuff.sigvaldason.com/email.html
1•harryday•43m ago•1 comments

Sea urchin species on brink of extinction after marine pandemic

https://www.theguardian.com/environment/2025/dec/11/sea-urchin-species-on-brink-of-extinction-aft...
2•mykowebhn•43m ago•0 comments

Threshold

https://studium.dev/notes/threshold
2•jerlendds•49m ago•0 comments

Microfeatures I'd like to see in more languages

https://buttondown.com/hillelwayne/archive/microfeatures-id-like-to-see-in-more-languages/
4•goranmoomin•50m ago•0 comments

US Navy pledges $448M to test if Palantir is seaworthy

https://www.theregister.com/2025/12/10/palantir_navy_448_million_contract/
2•rjzzleep•51m ago•1 comments

Ask HN: What hard problems are still underexplored?

3•brihati•52m ago•1 comments

Storm-search: VS Code extension with global search that is useful

https://github.com/zigcBenx/storm-search
1•thunderbong•52m ago•0 comments

AI Product Retention Crisis: Why Users Aren't Staying

https://medium.com/@gp2030/ai-product-retention-crisis-why-users-arent-staying-1ecb781ac5c2
2•light_triad•54m ago•0 comments

There's a Database of Startup Ideas Here

6•suhaspatil101•56m ago•0 comments

JSON to Video

https://jsontovideo.org/
1•vvalvyvv•1h ago•0 comments

Xplora – A Smartwatch Designed for Kids

https://xplora.dk/
1•MrJagil•1h ago•0 comments