frontpage.
newsnewestaskshowjobs

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?

How Would For-Hire Autonomous Vehicles Impact NYC?

https://www.openplans.org/how-for-hire-autonomous-vehicles-impact-nyc
1•geox•1m ago•0 comments

The Return (2024 Film)

https://en.wikipedia.org/wiki/The_Return_(2024_film)
1•BiraIgnacio•2m ago•1 comments

The Reverse Information Paradox (Satya Nadella)

https://snscratchpad.com/posts/reverse-information-paradox/
1•adletbalzhanov•3m ago•0 comments

CRA Compliance Kit – EU Cyber Resilience Act in One Pip Install

https://starcaller.uk/cra-compliance/
1•sparka•3m ago•0 comments

Hugging Face Data Breach

https://techcrunch.com/2026/07/20/hugging-face-confirms-breach-affected-internal-datasets-and-cre...
2•dotmanish•3m ago•0 comments

Stop Using OpenCode

https://wren.wtf/shower-thoughts/stop-using-opencode/
2•alekq•6m ago•0 comments

AgentAbstain: Do LLM Agents Know When Not to Act?

https://arxiv.org/abs/2607.10059
2•embedding-shape•6m ago•0 comments

AGI Singer: Take the Next Exit

https://medium.com/@miho999lv/agi-singer-take-the-next-exit-21355823c289
2•miho999lv•8m ago•0 comments

E-scooters set to be banned for under-18s

https://www.rte.ie/news/ireland/2026/0720/1584131-escooters-ireland-meeting/
2•austinallegro•9m ago•0 comments

ESP32 Server: Distributing HTTP/2 Streams over TLS

https://c410-f3r.github.io/thoughts/esp32-server-distributing-http2-streams-over-tls/
1•CaioFer•9m ago•0 comments

How the Apple Watch water lock feature works

https://www.engadget.com/2213629/how-apple-watch-water-lock-feature-works/
1•bookofjoe•10m ago•0 comments

The Tablet the Doctor Ordered

https://cuencahighlife.com/the-tablet-the-doctor-ordered/
1•dxs•11m ago•0 comments

Proof of Fermat Last Theorem from Scratch [video]

https://www.youtube.com/watch?v=9f-hGSh8lF0
1•surprisetalk•11m ago•0 comments

Rust 2018: Libraries in the 2018 Epoch

https://zayenz.se/blog/post/rust-2018/
1•ibobev•11m ago•0 comments

Trump's War on the Future, Monetary Edition

https://paulkrugman.substack.com/p/trumps-war-on-the-future-monetary
2•dxs•11m ago•0 comments

Programming the Amiga and Atari ST in C: Reading Keyboard Input

https://retrogamecoders.com/st-amiga-vbcc-c-input-echo/
1•ibobev•11m ago•0 comments

'Synthetic insider' attacks raise stakes for corporate cyber defence

https://www.ft.com/content/67fe2b44-2041-4ee1-b606-5def4d717407
1•thm•12m ago•0 comments

Cross-Platform Amiga and Atari ST C Programming ("Not Conio but Compatible")

https://retrogamecoders.com/st-amiga-vbcc-c-not-conio/
1•ibobev•12m ago•0 comments

Making a Simulation Game – Part 2: The Engine Doesn't Know What Beer Is

https://scarlet.engineering/blog/making-simulation-game-part-2-architecture/
1•poga•14m ago•0 comments

The 'anti-Greta Thunberg' weather nerd debunking climate myths

https://nypost.com/2025/05/31/us-news/meet-the-anti-greta-thunberg-weather-nerd-debunking-climate...
2•bilsbie•14m ago•0 comments

The Library of Babel

https://ryanbieber.github.io/libraryofbabel/
1•carnufex•17m ago•0 comments

Search Risk vs. Execution Risk

https://www.zakihsn.com/writing/building/search-risk-vs-execution-risk
1•zakihasan•21m ago•1 comments

Pegel – catch silent data breakage in Postgres before it reaches your dashboards

https://data-watchtower.com
1•mckeco•22m ago•0 comments

Sarah's Wager

https://colossus.com/article/sarah-guo-conviction/
1•jger15•24m ago•0 comments

The CIAM Graveyard: Every Dead Identity Vendor and What Killed Them

https://securityboulevard.com/2026/07/the-ciam-graveyard-every-dead-identity-vendor-and-what-kill...
2•mooreds•25m ago•0 comments

The Scrolly Chair

https://www.newcartographies.com/p/the-scrolly-chair
1•rpgbr•25m ago•0 comments

The footprints of every building in NYC – updated weekly

https://www.beautifulpublicdata.com/the-footprints-of-every-building-in-nyc/
2•jonathanmkeegan•26m ago•0 comments

New Spinning Drone Hides in Plain Sight

https://www.mccormick.northwestern.edu/news/articles/2026/07/new-spinning-drone-hides-in-plain-si...
1•DemiGuru•29m ago•0 comments

Dungeons and Dryers

https://thega.me.uk/2026/07/dungeons-and-dryers/
1•surprisetalk•30m ago•0 comments

Text-to-CAD Is Too Small for Building Real Hardware

https://opuslabs.substack.com/p/hardware-needs-its-vibe-coding-moment
1•opuslabs•30m ago•0 comments