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?

Simulating Realistic Order Execution for Crypto Backtesting

https://medium.com/@DolphinDB_Inc/stop-backtesting-in-theory-simulate-the-real-crypto-market-with...
1•chaercling•2m ago•0 comments

Show HN: Focal Harvest – local web research and OSINT pipeline

https://techno-neighbour.github.io/focal-harvest/
1•xlr8_track•4m ago•1 comments

I Have Thoughts on the iPhone Air

https://christianselig.com/2026/07/iphone-air-review/
1•janandonly•5m ago•0 comments

AV1Converter

https://github.com/framicheli/av1converter
1•francescomi•5m ago•1 comments

Self-Hosting Turns Your Team into the Knowledge Base's Service Provider

https://ones.com/blog/self-hosting-turns-your-team-into-the-knowledge-bases-service-provider/
1•coding1134•10m ago•0 comments

Encrypted, but wrong: Group chats vulnerable to manipulated content

https://www.heise.de/en/news/Encrypted-but-wrong-Group-chats-vulnerable-to-manipulated-content-11...
1•codethief•16m ago•1 comments

Solsticio – a daily sun/moon logic puzzle with a deterministic generator

https://solsticio.app/
1•pepinal•17m ago•0 comments

Graft

https://github.com/NanoNets/Graft
1•handfuloflight•17m ago•0 comments

Guix by Nix

https://fzakaria.com/2026/07/29/guix-by-nix
1•ingve•18m ago•0 comments

Low Danube river levels force Romania to shut down its nuclear power reactors

https://www.reuters.com/business/energy/low-danube-river-levels-force-romania-shut-down-both-its-...
1•_tk_•23m ago•0 comments

SFR (French Internet provider) is blocking opencode.ai

2•krikou•25m ago•2 comments

FreeBSD: Missing Mac validation in wg(4) packet decryption

https://www.freebsd.org/security/advisories/FreeBSD-SA-26:52.if_wg.asc
1•dchest•26m ago•1 comments

FreshSaaS.online

https://freshsaas.online/
1•Coineater•26m ago•2 comments

Jump Lists in Depth

https://binaryforay.blogspot.com/2016/02/jump-lists-in-depth-understand-format.html
1•ankitg12•33m ago•0 comments

Show HN: An app that logs your meal's calories from a photo

https://btrapp.com/
2•behzodhalil•34m ago•1 comments

Tiny circuit turns a hidden property of electrons into a working info channel

https://www.nanowerk.com/nanotechnology-news3/newsid=69875.php
1•geox•38m ago•0 comments

Replacing the Kobo Libra H2O Battery

https://ei3lh.eu/2025/11/20/replacing-the-kobo-libra-h2o-battery/
1•austinallegro•43m ago•0 comments

Lasers could help provide fuel for nuclear reactors

https://www.technologyreview.com/2026/07/27/1140798/laser-nuclear-enrichment/
2•rbanffy•44m ago•0 comments

Radiation Tradeoffs for Mars – How to get by when the sky wants you dead

https://mceglowski.substack.com/p/radiation-tradeoffs-for-mars
1•calcifer•44m ago•0 comments

Fleet: Hierarchical Task-Based Abstraction for Megakernels on Multi-Die GPUs

https://arxiv.org/abs/2604.15379
1•matt_d•44m ago•0 comments

North Korea-linked hackers targeted major NPM packages

https://aws.amazon.com/blogs/security/amazon-identifies-north-korean-hacker-group-behind-open-sou...
1•BlueBerry2001•50m ago•0 comments

When Your Video Call Freezes, the Problem Is Not What You Think

https://capytoolkit.com/blog/guides/video-call-freezes-p2p-connectivity-diagnostic/
1•CapyToolkit•51m ago•0 comments

Who decides when the task is done? Moving completion authority to checkers

https://zenodo.org/records/21698264
1•kushagrab21•52m ago•0 comments

Gen1Recomp – Native LÖVE2D Recreation of Poke Red, Blue and Yellow

https://github.com/bryanthaboi/gen1recomp
1•throwaway270925•53m ago•0 comments

Building an LSTM-Based Trading Model for Cryptocurrency Markets

https://medium.com/@DolphinDB_Inc/from-factor-discovery-to-live-signals-unified-stream-batch-proc...
2•napgirllll•53m ago•0 comments

Red Cross declares crisis over blood supply shortage in US for 2nd its history

https://www.bbc.com/news/articles/c74gze89783o
1•Teever•54m ago•0 comments

Qualcomm Completes Acquisition of Modular

https://www.modular.com/blog/qualcomm-completes-acquisition-of-modular
1•samuell•54m ago•0 comments

Elon Musk's xAI is trying to sue its way out of a Grok reckoning

https://arstechnica.com/tech-policy/2026/07/elon-musks-xai-is-trying-to-sue-its-way-out-of-a-grok...
3•rbanffy•55m ago•0 comments

An overlooked geothermal plant got a second chance

https://www.technologyreview.com/2026/07/29/1140896/geothermal-second-chance/
3•joozio•56m ago•0 comments

Highlights from the Discourse on the Hugging Face Incident

https://www.astralcodexten.com/p/highlights-from-the-discourse-on
2•Michelangelo11•58m ago•0 comments