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?

Function Composition from C++17 to C++23

https://freshsources.com/code-capsules/composing-functions/
1•chuckallison•1m ago•1 comments

Show HN: Kaupang – a push-based deploy CLI, now with a drag-and-drop builder

https://github.com/kaupang-dev/kaupang
1•witnz•1m ago•0 comments

The engineering practices Claude Code and Codex use to improve AI agents

https://www.andrewjesson.com/blog/the-engineering-practices-claude-code-and-codex-use-to-improve-...
1•anndvision•1m ago•0 comments

Git worktrees – why should I use them?

https://github.blog/ai-and-ml/github-copilot/what-are-git-worktrees-and-why-should-i-use-them/
1•onnnon•2m ago•0 comments

Databricks Iceberg Support Has a Catch. It's Called Unity Catalog

https://www.onehouse.ai/blog/databricks-iceberg-support-has-a-catch-its-called-unity-catalog
1•LexSiga•3m ago•0 comments

Show HN: Yet Another News Reader

https://boomerang-news.com
1•messel•4m ago•0 comments

GitHub Action to grade OpenAPI schema quality (A–F) and catch breaking changes

https://github.com/marketplace/actions/typemorph-schema-check
1•jop00004•6m ago•0 comments

Lords urgent question on the suspension of Anthropic's AI models [video]

https://www.youtube.com/watch?v=1Dw_k_Bs95A
1•haritha-j•6m ago•0 comments

HPE Discover 2026 Keynote Coverage

https://www.servethehome.com/hpe-discover-2026-keynote-coverage/
1•ksec•7m ago•1 comments

CLI AI Tool Laucher

https://github.com/tjbmoose09/ai-tool-launcher
1•tjbmoose09•8m ago•1 comments

Show HN: Multiplayer Space Game

https://voidhorizon.net
1•messel•10m ago•0 comments

Writing an echo server in libev and C++ (2011)

https://www.skitoy.com/posts/writing-an-echo-server-in-libev-and-c/
1•mooreds•10m ago•0 comments

Using the stars and paddles, indigenous Taiwanese recreate risky sea journey

https://www.cnn.com/2026/06/17/asia/taiwan-indigenous-paddle-philippines-intl-hnk
1•mooreds•11m ago•0 comments

El Niño is here, so what does it mean?

https://text.npr.org/g-s1-128448
1•mooreds•11m ago•0 comments

What is a data semantic layer?

https://getbruin.com/blog/what-is-a-semantic-layer/
1•arsalann•11m ago•0 comments

"How dare we use something like that..." – Why generative AI artwork is a no...

https://www.gamesindustry.biz/how-dare-we-use-something-like-that-on-someones-dream-why-generativ...
1•dude250711•12m ago•0 comments

Private Tap-to-Pay

https://walt.is
1•627467•13m ago•0 comments

Denmark desperately needs more inequality

https://world.hey.com/dhh/denmark-desperately-needs-more-inequality-8e84a8d0
3•peterspath•13m ago•0 comments

How to make LVT politically doable

https://wilsoniumite.com/2026/06/17/how-to-make-lvt-politically-doable/
2•Wilsoniumite•13m ago•0 comments

Show HN: Noject – menubar app to stop drive ejections on macOS

https://scaleninja.com/noject/
2•rohityadavcloud•14m ago•0 comments

Cosmodial Sky Atlas

https://frankforce.com/cosmodial-sky-atlas/
1•surprisetalk•15m ago•0 comments

Behind Python: The Languages That Power AI

https://arxiv.org/abs/2606.18141
1•runningmike•15m ago•1 comments

Don't Stack Weaknesses

https://staysaasy.com/startups/2026/06/15/stacked-weaknesses.html
1•RyeCombinator•16m ago•0 comments

Cockroaches scurry around with pieces of bacterial genomes

https://arstechnica.com/science/2026/06/cockroaches-scurry-around-with-thousands-of-pieces-of-bac...
1•haeseong•17m ago•0 comments

Show HN: OpenC6 BIOS – A PC-like bare-metal bootloader and OS for ESP32-C6

https://github.com/Rompass/openc6-bios
2•Rompass•17m ago•0 comments

Certain Ultra-processed Foods more Addictive than Others

https://www.cnn.com/2026/06/17/health/addictive-ultraprocessed-foods-wellness
1•jakzurr•18m ago•1 comments

A generic tragedy: Why PHP's Generics vote failed

https://tempestphp.com/blog/a-generic-tragedy
2•nvahalik•18m ago•0 comments

Sixty percent of US consumers say 'AI' in brand messaging is a turnoff

https://wpvip.com/future-of-the-web-2026/
25•thm•19m ago•4 comments

Pandas for Reproducible Data Analysis

https://arxiv.org/abs/2606.14924v1[pdf]
1•runningmike•25m ago•1 comments

PHP Through a Screen Reader: Small Syntax Choices That Matter

https://thephp.foundation/blog/2026/06/16/php-through-a-screen-reader-small-syntax-choices-that-m...
2•MrVandemar•25m ago•0 comments