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

"But HTTPS encrypts everything" – A WiFi security conversation

https://lolwifi.network/conversation
1•splintersio•1m ago•1 comments

Zillow Removes Climate Risk Scores from Home Listings

https://www.nytimes.com/2025/11/30/climate/zillow-climate-risk-scores-homes.html
2•throwaway81523•10m ago•0 comments

Crow: Agentic Copilot Builder

https://www.usecrow.org/
2•jaixbhatia•13m ago•1 comments

Refining my process of attacking large codebases and contributing to PyTorch

https://michaelgathara.org/pytorch_lessons
1•Michaelgathara•13m ago•0 comments

Radicle is a sovereign code forge built on Git

https://radicle.xyz
1•nnx•16m ago•0 comments

Bricklink suspends Marketplace operations in 35 countries (developing story)

https://jaysbrickblog.com/news/bricklink-suspends-marketplace-operations-in-35-countries/
1•makeitdouble•17m ago•0 comments

Visi on (DOS Software)

https://en.wikipedia.org/wiki/Visi_On
1•rickcarlino•21m ago•0 comments

LTT Linus Torvalds interview [video]

https://m.youtube.com/watch?v=mfv0V1SxbNA&pp=0gcJCRUKAYcqIYzv
4•LorenDB•25m ago•0 comments

Show HN: CSS Advent Calendar 2025

https://cssadventcalendar.dev/
1•steveharrison•26m ago•0 comments

Cosmolab: Rapid audio hardware prototyping – by Faselunare [video]

https://www.youtube.com/watch?v=7OJFybRz65U
1•doctaj•27m ago•0 comments

Hans Moravec: When will computer hardware match the human brain? (1997)

https://web.archive.org/web/20080820105716/https://www.transhumanist.com/volume1/moravec.htm
2•leoc•30m ago•1 comments

Tenets of Great Product Executives

https://chiefofproduct.com/FiveTenets/
1•mooreds•32m ago•0 comments

Liberal towns backtrack on license plate trackers amid concerns about privacy

https://www.politico.com/news/2025/11/30/license-plate-trackers-pushback-00670550
6•JumpCrisscross•33m ago•1 comments

Make It Easy for Humans First, Then AI

https://tombedor.dev/make-it-easy-for-humans/
1•jjfoooo4•34m ago•0 comments

Posty: Turn your Mastodon archive file into a standalone static HTML site

https://codeberg.org/oliphant/posty
2•sohkamyung•38m ago•0 comments

More of Silicon Valley is building on free Chinese AI

https://www.nbcnews.com/tech/innovation/silicon-valley-building-free-chinese-ai-rcna242430
4•freejoe76•40m ago•0 comments

Social-Media Platform Strava Makes You Tell the Truth

https://www.nytimes.com/2025/11/25/magazine/strava-running-social-media.html
2•bookofjoe•41m ago•1 comments

Show HN: I built utm.one a clean, minimal shortener+UTM governance tool (beta)

https://utm.one/
1•Raj7k•45m ago•0 comments

Passwords and Their Significance [pdf]

https://ora.ox.ac.uk/objects/uuid:57d9d9d8-162b-4766-808b-f5a6d571d4ef/files/mcb508a99c4f482b1ce4...
1•mooreds•47m ago•0 comments

Rhesus

https://cosmicdream.com/gutenberg/plays/rhesus.html
1•mooreds•47m ago•0 comments

Show HN: Free AI Coding with Open Source and Deca Models

https://github.com/GenLabsAI/Agentica/releases/tag/v0.0.1
2•GenLabs-AI•49m ago•0 comments

Two Men. One Identity. They Both Paid the Price

https://www.nytimes.com/2025/11/23/us/undocumented-worker-stolen-identity-dan-kluver.html
2•thelastgallon•51m ago•0 comments

Supabase CEO on the "painful" decisions that built a $5B company

https://techcrunch.com/podcast/supabase-ceo-on-the-painful-decisions-that-built-a-5b-company/
1•cmogni1•55m ago•1 comments

Viral Show HN Posts

https://blog.sturdystatistics.com/posts/show_hn/
1•kianN•56m ago•0 comments

Show HN: CLI that generates and prepares to email PDF invoices

https://github.com/LeanerCloud/invoicr
2•alien_•58m ago•1 comments

Nimzo – Grischuk Gambit

https://lichess.org/@/LittleSoapBubble/blog/nimzo-grischuk-gambit/Fccy6JN2
1•fzliu•59m ago•0 comments

Why did Taylor Swift fans get amnesia after Eras Tour; phenomenon addressed

https://www.themirror.com/entertainment/celebrity-news/taylor-swift-eras-tour-amnesia-1451365
2•scireviewer•1h ago•0 comments

Greenlight is an open-source client for xCloud and Xbox home streaming

https://github.com/unknownskl/greenlight
1•doener•1h ago•0 comments

Show HN: Aion – AI longevity coach using wearables, blood tests and facial scans

https://app.aionlongevity.com/
1•nevenp•1h ago•0 comments

Show HN: Identifiy test coverage gaps in your Go projects

https://github.com/LeanerCloud/testvet
1•alien_•1h ago•0 comments