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?

Show HN: A free wedding seating planner with no signup required

https://happywedding.cc/
1•ulicaki8991•1m ago•0 comments

TrustedRouter Gives Companies Greater Privacy with AI

https://www.bloomberg.com/news/newsletters/2026-11-26/trustedrouter-aims-to-give-companies-greate...
1•ljlolel•2m ago•0 comments

Show HN: Pocket Garden – 150 plus web games in a virtual console

https://triptych.github.io/web-games-andrew/console/
1•triptych•6m ago•0 comments

Kim Dotcom's notes on his US extradition trial

https://docs.proton.me/
1•yde_java•7m ago•0 comments

Poland to create no-fly zone at border after repeated airspace violations

https://www.france24.com/en/poland-says-will-create-no-fly-zone-at-ukraine-border-after-repeated-...
1•vrganj•8m ago•1 comments

Yubikey PQC Beta Program

https://www.yubico.com/pqc-beta-program/
1•ahlCVA•8m ago•0 comments

3-SAT as a Game on the Boolean Hypercube

https://macsad.com/
1•tristenharr•10m ago•0 comments

Gemini Distillation Service

https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/tuning/distillation
1•partsch•11m ago•1 comments

An Introduction to Uncertainty in Machine Learning

https://chrhenning.com/blog/2026/introduction-to-uncertainty/
1•chrhenning•12m ago•0 comments

Privacy Guides

https://www.privacyguides.org/
1•basilikum•13m ago•0 comments

Teaching is your craft. Managing everything around it is ours

https://tutorscrm.com/
1•shydrablack•14m ago•0 comments

At Albuquerque's Indian Pueblo Kitchen, Native American dishes are main course

https://text.npr.org/nx-s1-5983712
1•mooreds•17m ago•0 comments

Doom, computed by curl – one curl process per RISC-V instruction

https://vashiru.tech/doom-computed-by-curl/
1•Vashiru•18m ago•1 comments

WhatsApp vs. NSO Group exploit analysis from the case files

https://www.courtlistener.com/docket/16395340/741/45/whatsapp-inc-v-nso-group-technologies-limited/
1•l0kihardt•18m ago•0 comments

AI Killed Agile [video]

https://www.youtube.com/watch?v=t94DyXLh_u8
1•adefwebserver•19m ago•3 comments

Faulty electrical goods returned to UK supermarkets end up on Ghana 'megadump'

https://www.theguardian.com/environment/2026/nov/26/ghana-waste-tip-faulty-electrical-goods-uk-su...
1•laurex•19m ago•0 comments

Antigravity Swarm, ported to every harness

https://github.com/STRML/swarm
1•STRML•20m ago•0 comments

Are the Top Literary Scholars Being Targeted by a Chinese Spy Op?

https://www.vanityfair.com/story/worlds-top-literary-scholars-targeted-by-chinese-spy-op
2•laurex•21m ago•0 comments

Surdz a free tool,try now

https://surdz.vercel.app/
1•romarumeth•22m ago•0 comments

Show HN: FileSwiss – Free, private file tools that run 100% in your browser

https://fileswiss.app/
1•Barrasa•24m ago•1 comments

Show HN: A OS workspace for small companies, 6 in 1

https://github.com/workinbox-io/inbox
2•jkalamarz•25m ago•0 comments

DFly2: Speculative decoding that reuses the target's sparse KV

https://twitter.com/TencentAI_News/status/2125968859450802415
1•MaKey•26m ago•0 comments

CuAl₂O₄ could make light-controlling components for smart glasses 120x thinner

https://phys.org/news/2026-11-copper-aluminum-oxide-components-smart.html
1•bookofjoe•26m ago•1 comments

Times – a Techmeme-style front page for chess news

https://www.64times.com/
1•ibalek•29m ago•1 comments

SAP considers at least 10,000 job cuts in AI restructuring, Bloomberg reports

https://www.reuters.com/technology/sap-considers-least-10000-job-cuts-ai-restructuring-bloomberg-...
3•frank_clover•31m ago•2 comments

How I Made Mezo's Documentation Agent-Ready

https://0xdezman.cv/blog/how-i-made-mezo-documentation-agent-ready/
1•adelekeabdulgan•32m ago•0 comments

Show HN: Debugging a slow Zola blog with an agentic performance test harness

https://runtimenotes.com/blog/debugging-a-slow-zola-blog-with-an-agentic-performance-test-harness/
1•runtimenotes•33m ago•0 comments

Is WordPress Dying? What Its 2026 Market Share Fall Shows

https://dizzidigital.com/blog/wordpress-market-share/
1•ms7892•36m ago•2 comments

Spec = Oasis from Ready Player One

https://github.com/Parzival-Moksha/uploader
1•Parzival_04515•37m ago•1 comments

Largest 2D Chart library in the world using BUI: BlenderUI

https://bui.preetham.top/charts/
5•ppmpreetham•40m ago•2 comments