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

The Khan Ted Institute [video]

https://www.youtube.com/watch?v=kEhRi1tFlhs
1•apparent•1m ago•0 comments

Contra Benn Jordan, data center (and all) sub-audible infrasound issues are fake

https://blog.andymasley.com/p/contra-benn-jordan-data-center-and
1•logicprog•5m ago•0 comments

Where Did FIFA Seat Lottery Winners?

https://seat-transparency.com/
2•hnburnsy•8m ago•0 comments

Deception is strongly amplified in the job market (a statistical model)

https://bosoncutter.substack.com/p/deception-is-amplified-by-default
3•the_tyger•12m ago•1 comments

Why every developer needs their own agent-skills

https://olshansky.substack.com/p/why-every-developer-needs-their-own
1•Olshansky•14m ago•0 comments

Vercel Incident Response Playbook

https://github.com/OpenSourceMalware/vercel-april2026-incident-response
3•6mile•21m ago•3 comments

Third New Glenn launch suffers upper stage malfunction

https://spacenews.com/third-new-glenn-launch-suffers-upper-stage-malfunction/
2•ExpertAdvisor01•31m ago•2 comments

Google should allow third-party search engines access to data, EU says

https://www.reuters.com/world/google-should-allow-third-party-search-engines-access-data-eu-says-...
3•1vuio0pswjnm7•31m ago•1 comments

Show HN: TikTok-style mobile scroller for Civitai, self-hosted recs on a $5 VPS

https://testflight.apple.com/join/JkKUCXY6
1•alongbottom•32m ago•0 comments

Earthset

https://twitter.com/astro_reid/status/2046009031613907029
1•jbegley•39m ago•0 comments

Salesforce Announces AI Initiative and Calls It 'Headless 360'

https://gizmodo.com/salesforce-announces-huge-ai-initiative-and-calls-it-headless-360-2000748243
4•Brajeshwar•42m ago•0 comments

Show HN: A free, offline-capable math quiz app

https://quiz.neuralrad.com
1•coolwulf•44m ago•1 comments

AAVE price sinks 18% as KelpDAO exploit spreads

https://ambcrypto.com/aave-price-sinks-18-as-kelpdao-exploit-spreads-what-happened/
1•wslh•46m ago•0 comments

China's 7-tonne cargo drone completes maiden flight

https://news.cgtn.com/news/2026-03-31/China-s-new-7-tonne-unmanned-cargo-drone-set-for-maiden-fli...
4•pseudolus•49m ago•1 comments

"In Your Darkest Days, How Did You Keep Going?"

https://www.youtube.com/watch?v=D_E4Be4Or_E
1•Brysonbw•49m ago•1 comments

Show HN: Vastlint, inline linting for ad tags in VS Code, Kiro, Cursor

https://github.com/aleksUIX/vastlint
3•aleksuix•49m ago•0 comments

The insider trading suspicions looming over Trump's presidency

https://www.bbc.com/news/articles/cge0grppe3po
58•blondie9x•50m ago•10 comments

Claude-desktop-buddy [small ESP32 hardware companion software]

https://github.com/anthropics/claude-desktop-buddy
1•daniel_iversen•54m ago•0 comments

Vinjari – Decentralized Browser

https://github.com/jj10133/vinjari
1•jj_3•58m ago•1 comments

GPT-6 released: Symphony architecture unifies text/image/audio/video

https://www.theverge.com/2026/4/14/openai-gpt-6-symphony-architecture
3•demiurges•1h ago•0 comments

Mosaico: A fast, configurable tiling window manager for Windows

https://github.com/jmelosegui/mosaico
2•jmelosegui•1h ago•0 comments

Chamath Palihapitiya's 30 Years of Business Advice in 13 Minutes

https://www.youtube.com/watch?v=0-LAT4HjWPo
1•Brysonbw•1h ago•0 comments

Show HN: I built a spaced-repetition vocab app tied to the books you read

https://read.erictyrrell.com/
2•Cicero22•1h ago•1 comments

Screenless Smartphone Patent

https://carsafe.org/soundmode/
2•ASFsound•1h ago•0 comments

Show HN: Modular – drop AI features into your app with two function calls

https://modular.run
5•modular_dev•1h ago•1 comments

Show HN: I built a local Elixir/Python pipeline to curate 14,000 RAW photos

https://qwelian.com/posts/FINE_SHYT_Intelligent_Curation_Tagging_for_Creative_Workflows
2•qweliantanner•1h ago•1 comments

How to Set Up OneBusAway Maglev with Bay Area Transit Data

https://opentransitsoftwarefoundation.org/2026/04/setting-up-maglev-bay-area-transit-data/
3•aaronbrethorst•1h ago•0 comments

Linux Foundation: Building a RISC-V CPU Core (LFD111x)

https://training.linuxfoundation.org/training/building-a-riscv-cpu-core-lfd111x/
3•xlmnxp•1h ago•0 comments

Humanoid robots race runners at Beijing half marathon [video]

https://www.youtube.com/watch?v=WnCfMRhbhZQ
1•mgh2•1h ago•0 comments

Electric Wind-Up Plane Uses Supercapacitors for Free Flight Fun

https://hackaday.com/2026/04/18/electric-wind-up-plane-uses-supercapacitors-for-free-flight-fun/
3•lxm•1h ago•1 comments