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?

Is Apple Intelligence Smart? We Tested Every Feature

https://www.steaktek.com/tech/is-apple-intelligence-actually-smart-we-tested-every-feature/
2•genuser•4m ago•1 comments

Microsoft Will Preload Windows 11 File Explorer to Fix Bad Performance

https://blogs.windows.com/windows-insider/2025/11/21/announcing-windows-11-insider-preview-build-...
1•ksec•13m ago•0 comments

Show HN: 12K Reddit posts scraped and AI-scored for startup ideas

https://search.reddit-business-ideas.workers.dev/
1•shadowjones•15m ago•0 comments

React Suite v6: A Steady Step Toward Modernization

https://medium.com/rsuite/react-suite-v6-a-steady-step-toward-modernization-2af78029978d
2•simonguo•15m ago•1 comments

Ask HN: Where can you find old NetBSD packages?

1•GaryBluto•15m ago•0 comments

Show HN: MoodLens – Provide insights about your emotional state

https://moodlens.aiwith.me/
1•struy•17m ago•0 comments

Cryptographers Held an Election. They Can't Decrypt the Results

https://www.nytimes.com/2025/11/21/world/cryptography-group-lost-election-results.html
1•ceejayoz•18m ago•0 comments

Empathetic, Available, Cheap: When A.I. Offers What Doctors Don't

https://www.nytimes.com/2025/11/16/well/ai-chatbot-doctors-health-care-advice.html
1•uxhacker•18m ago•0 comments

On the Death of Tech Idealism (and Rise of the Homeless) in Northern California

https://lithub.com/on-the-death-of-tech-idealism-and-rise-of-the-homeless-in-northern-california/
2•pseudolus•24m ago•0 comments

MCP Apps: Extending servers with interactive user interfaces

http://blog.modelcontextprotocol.io/posts/2025-11-21-mcp-apps/
2•raykyri•35m ago•0 comments

GrapheneOS accuses compeitors of sabotage, exits France over police threats

https://piunikaweb.com/2025/11/21/grapheneos-accuses-murena-iode-of-sabotage-pulls-servers-from-f...
2•RachelF•37m ago•0 comments

Preamble to a Psychofauna Bestiary

https://www.hopefulmons.com/p/preamble-to-a-psychofauna-bestiary
1•Anon84•42m ago•0 comments

Run0 –Empower

https://mastodon.social/@daandemeyer/115565105032166177
1•GalaxyNova•44m ago•0 comments

International Cloud Atlas

https://cloudatlas.wmo.int/en/home.html
3•bookofjoe•52m ago•0 comments

Hacked iPhone running iPadOS + a Mac-like experience on an external monitor

https://old.reddit.com/r/iphone/comments/1p3e2bf/my_hacked_iphone_running_ipados_and_running_a/
1•TechExpert2910•54m ago•0 comments

Infinibay LXD Container

https://github.com/Infinibay/lxd
2•angaroshi•57m ago•0 comments

Beyond Earnings Premia: Debt-Adjusted Returns to Postsecondary Education

https://papers.ssrn.com/sol3/papers.cfm?abstract_id=5375794
3•PaulHoule•59m ago•0 comments

A Tap-to-Pay Society Is Leaving New Yorkers Behind

https://www.nytimes.com/2025/11/21/nyregion/cashless-economy.html
3•perihelions•1h ago•0 comments

Graphics API is irrelevant [video]

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

Nano Banana Pro Can Generate a Image from Lat Long

https://chat.vlm.run/c/8ff868bb-e188-4677-b38e-46301d30aac9
1•visioninmyblood•1h ago•1 comments

How to get started with the ed text editor (2022)

https://www.redhat.com/en/blog/introduction-ed-editor
2•todsacerdoti•1h ago•0 comments

C64 gets Doom-style shooter

https://hackaday.com/2025/11/21/commodores-most-popular-computer-gets-doom-style-shooter/
1•amichail•1h ago•0 comments

Wikidive: A tool to deep dive into Wikipedia rabbitholes

https://wikidive.net/dive?topic=Cognition
2•atulvi•1h ago•0 comments

How to use the internet, 1995 [video]

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

Bret Taylor's Sierra Reaches $100M ARR in Under Two Years

https://techcrunch.com/2025/11/21/bret-taylors-sierra-reaches-100m-arr-in-under-two-years/
1•karakoram•1h ago•0 comments

Show HN: Free SEO Image Generator WordPress Plugin – Rule Based and Zero AI

https://github.com/atraining/featured-image-generator-wordpress
1•chelm•1h ago•1 comments

Erik Prince, America's most notorious mercenary, spies opportunity in chaos

https://www.economist.com/international/2025/11/21/erik-prince-americas-most-notorious-mercenary-...
3•rguiscard•1h ago•2 comments

I made an app because we kept double feeding our cat

https://www.kibblo.co/
1•hackfast•1h ago•1 comments

Behind Amazon's quiet launch of Haul, which competes with Temu

https://www.cnbc.com/2024/12/22/amazon-haul-takes-on-temu-to-bring-shoppers-cheap-goods-from-chin...
1•mgh2•1h ago•0 comments

Installing FreeBSD 15 on my desktop

https://yorickpeterse.com/articles/installing-freebsd-15-on-my-desktop/
6•todsacerdoti•1h ago•1 comments