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•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?

'It's Not a Joke': A 'Simpsons' Writer Holds His First Presidential Campaign Ra

https://www.wired.com/story/simpsons-writer-dan-greaney-holds-his-first-presidential-campaign-rally/
1•joozio•38s ago•0 comments

Symbolica: Computer Algebra Library

https://symbolica.io/
1•gurjeet•9m ago•0 comments

Meta to give staff 30min breaks from keylogging

https://www.theregister.com/ai-and-ml/2026/06/04/meta-to-allow-staff-breaks-from-keylogging-data-...
2•seanhunter•18m ago•0 comments

Show HN: HN Reader for VS Code with Obsidian Saving

https://marketplace.visualstudio.com/items?itemName=MichaelGoose.hn-reader
4•javatuts•23m ago•0 comments

Show HN: Rune – A focused Markdown writer for desktop (Tauri/Rust)

https://github.com/JangHyun-bin/Rune
2•narnia0981•24m ago•0 comments

I built an open-source platform for ML benchmarks and leaderboards

https://runbenchhub.com/
2•yakirmat•24m ago•1 comments

Vim Classic 8.3 Released

https://vim-classic.org/news/vim-8.3-released.html
2•tempodox•25m ago•0 comments

Show HN: SVAHNAR – Serverless infrastructure to run AI agents in isolated VMs

https://www.svahnar.com/
2•Chethan_Polanki•26m ago•0 comments

Exploring Rust Dependency-Toolchain Compatibility

https://tigerbeetle.com/blog/2026-04-24-toolchain-horizons/
2•tosh•31m ago•0 comments

Nagent – Not an Agent

https://github.com/macton/nagent
2•thdr•32m ago•0 comments

Science Is Drowning in AI Slop

https://www.theatlantic.com/science/2026/01/ai-slop-science-publishing/685704/
4•Michelangelo11•34m ago•0 comments

Llllllll.co

https://llllllll.co/
2•sans_souse•37m ago•0 comments

OpenAI plots biggest ChatGPT overhaul since launch

https://www.ft.com/content/ca0f5f5e-fb9a-41a0-a2a9-0127e15b7db9
2•thm•43m ago•0 comments

Obsidian-agent-bridge – let AI agents read, write, and deepen Obsidian vaults

https://github.com/samuraisguilt-jpg/obsidian-agent-bridge
3•roninin•46m ago•0 comments

Story Engine – High-Intensity Strategic Simulation Test Report

https://gist.github.com/wangkening3-eng/1d5411673ea84e328f0a06a83dc1fd8e
2•field_reader•52m ago•0 comments

7 Ways New Engineers Can Flourish in the Age of AI

https://spectrum.ieee.org/7-ways-engineers-flourish-ai
2•jruohonen•54m ago•0 comments

Quibi – Billion Dollar Company liquidated in less than a year of launch

https://en.wikipedia.org/wiki/Quibi
3•gurjeet•55m ago•0 comments

Ask HN: Alternatives to Hotline Telegram CRM?

2•hotline•56m ago•0 comments

A User's Guide to Midlife

https://www.nytimes.com/interactive/2024/06/24/well/live/midlife-health-body-changes-guide.html
1•saikatsg•59m ago•0 comments

Reverse-engineering SwiftUIs DocumentGroup to restyle and group untouchable tabs

https://github.com/uncSoft/Tabberwocky
1•uncSoft•1h ago•0 comments

Show HN: Cook perfectly with highly precise recipes

https://reloadium.com/reloadium-recipes/
1•julienreszka•1h ago•0 comments

Sorry, I'm Not Available. Talk to the A.I. Version of Me

https://www.nytimes.com/2026/06/06/business/dealbook/ai-digital-twin.html
3•iancmceachern•1h ago•0 comments

The 29th International Obfuscated C Code Contest (IOCCC) 2025 Winners

https://www.ioccc.org/2025/
47•matt_d•1h ago•6 comments

New AR Drawing App Challenges the $10/Month Subscription Model on Android

https://play.google.com/store/apps/details?id=com.VionixStudio.ARDraw.car.bike.jet&hl=en_US
1•VionixStudio•1h ago•0 comments

Show HN: Dubbl – open-source accounting for founders and developers

https://dubbl.dev
1•meszmate•1h ago•0 comments

The sorry state of skill distribution

https://blog.trailofbits.com/2026/06/03/the-sorry-state-of-skill-distribution/
1•jruohonen•1h ago•0 comments

We should be getting better at AI by now

https://www.ft.com/content/9753a44c-bec8-4d89-bac6-3416713c3166
1•1vuio0pswjnm7•1h ago•1 comments

Learn from my lesson, don't take your pre seed through stripe = Account Closure

3•pureyang•1h ago•0 comments

Snap, Crackle and Pop: Fourth, fifth, and sixth derivatives of position

https://en.wikipedia.org/wiki/Fourth,_fifth,_and_sixth_derivatives_of_position
1•aragonite•1h ago•0 comments

Trying a New Approach to Note-Taking on Books

https://v5.chriskrycho.com/notes/trying-a-new-approach-to-note-taking-on-books/
1•Tomte•1h ago•0 comments