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

Show HN: TeletextSignals – Local RAG over 25 Years of Swiss Teletext News

https://github.com/r-follador/TeletextSignals
1•folli•1m ago•0 comments

TWC Security Party – Group education event for tech workers to improve their PR

https://us02web.zoom.us/meetings/83864945846/invitations?signature=4UIf8C8zlkKWDox7ZdErZvL2DhcwC8...
1•todsacerdoti•2m ago•0 comments

Using Tokio with CPU-Bound Tasks in Rust

https://www.influxdata.com/blog/using-rustlangs-async-tokio-runtime-for-cpu-bound-tasks/
1•Abbit•5m ago•0 comments

Pg-safeupdate: A PostgreSQL extension requiring criteria for UPDATE and DELETE

https://github.com/eradman/pg-safeupdate
1•tanelpoder•5m ago•1 comments

Situation Watch

https://www.situation.watch/
1•brodouevencode•7m ago•0 comments

Interaction System for Treadmill Video Games Using a Smartphone Camera

https://www.mdpi.com/1424-8220/26/1/20
1•PaulHoule•10m ago•0 comments

Trump Officials Vow to Keep All US Coal Plants Running

https://www.bloomberg.com/news/articles/2026-01-15/trump-officials-vow-to-keep-all-us-coal-plants...
1•toomuchtodo•10m ago•0 comments

StackWarp: Exploiting Stack Layout Vulnerabilities in Modern Processors

https://roots.ec/blog/stackwarp
1•matt_d•10m ago•0 comments

Open Source Strategies

https://tempestphp.com/blog/open-source-strategies
1•7777777phil•10m ago•0 comments

Microsoft may soon allow IT admins to uninstall Copilot

https://www.bleepingcomputer.com/news/microsoft/microsoft-may-soon-allow-it-admins-to-uninstall-c...
1•janandonly•10m ago•0 comments

Database Transactions

https://planetscale.com/blog/database-transactions
1•ksec•11m ago•0 comments

At the Turning of the Tide: How to Fight Our Way Out of the Trump Era

https://crimethinc.com/2025/12/16/at-the-turning-of-the-tide-how-fight-our-way-out-of-the-trump-era
3•angoragoats•12m ago•0 comments

Sign of the times: Amazon is making a fallout shelter reality TV show

https://www.engadget.com/entertainment/tv-movies/amazon-is-making-a-fallout-shelter-competition-r...
2•dreadsword•12m ago•0 comments

Hyperfocus vs. Perspective as a Staff Engineer (2023)

https://softwaredoug.com/blog/2023/06/15/hyperfocus-vs-perspective
1•softwaredoug•12m ago•0 comments

Show HN: Bldr – polyglot build system for monorepos

https://github.com/GriffinCanCode/bldr
1•griffincancode•12m ago•0 comments

Show HN: Grain Synonym: Create multi-aesthetic OS variants

https://codeberg.org/teambrick06/yz/src/branch/main/docs/core-coordination/2026-01-15-121503-pst_...
1•kae3g•12m ago•0 comments

Show HN: Crystal Unified – Search compressed archives without decompressing

https://github.com/powerhubinc/crystal-unified-public
1•danebl•15m ago•0 comments

Show HN: GoGen – A simple template-based file generator written in Go

https://github.com/zaheershaikh936/gogen
2•zaheer9360•15m ago•1 comments

The Speed Playbook – Made $1.3k MRR in 30 days at 17

https://1kfounderplaybook.framer.website/
1•sillygoose_189•16m ago•1 comments

Show HN: The Hessian of tall-skinny networks is easy to invert

https://github.com/a-rahimi/hessian
1•rahimiali•16m ago•0 comments

Ask HN: Estimating % of dev using coding assistants

1•japoneris•17m ago•1 comments

Ten Years of Dashcams

https://alec.is/posts/ten-years-of-dashcams/
2•arm32•20m ago•0 comments

I Read Honey's Source Code [video]

https://www.youtube.com/watch?v=_acTMUmdY9M
1•EPendragon•20m ago•0 comments

MCP CLI: A Way to Call MCP Servers Efficiently

https://www.philschmid.de/mcp-cli
1•gmays•20m ago•0 comments

Why Open Source Matters

https://guille.site/posts/why-open-source/
2•LolWolf•21m ago•0 comments

Just Get a Better Job

https://idiallo.com/blog/just-get-another-job
5•firefoxd•22m ago•0 comments

ChatGPT wrote "Goodnight Moon" suicide lullaby for man who later killed himself

https://arstechnica.com/tech-policy/2026/01/chatgpt-wrote-goodnight-moon-suicide-lullaby-for-man-...
3•mirabilis•22m ago•0 comments

Ask HN: Why don't people value their code?

1•mrdependable•22m ago•1 comments

New DNA analysis reveals an Ice Age wolf's last meal

https://www.cnn.com/2026/01/15/science/woolly-rhinoceros-extinction-frozen-wolf
1•breve•30m ago•0 comments

Linux boxes via SSH: suspended when disconected

https://shellbox.dev/
12•messh•32m ago•3 comments