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: I indexed 37h of my videos using an RTX 4090 and local ML models in 24h

1•iliashad•1m ago•0 comments

A single MR with 52k commits had stalled GitLab CI

https://gitlab.com/gitlab-com/gl-infra/production/-/work_items/22412
2•ramon156•2m ago•0 comments

GitLab CI Is Down

https://status.gitlab.com/
2•absqueued•3m ago•1 comments

VPSMaxxing – Migrate Your Codex, Claude Code and Other Agents to a VPS

https://github.com/Kuberwastaken/VPSmaxxing
1•kuberwastaken•4m ago•1 comments

The emergence of human influence on the ozone layer by the 1960s

https://www.pnas.org/doi/10.1073/pnas.2608286123
1•croes•5m ago•0 comments

Why does AI still forget what your codebase is "for"?

https://www.reddit.com/r/Brunelly/s/UdTgItmmlS
1•RihabAI•5m ago•0 comments

How Americans see their country's past, present and future

https://www.economist.com/graphic-detail/2026/06/29/how-americans-see-their-countrys-past-present...
1•giuliomagnifico•6m ago•0 comments

On Lazy Secrets Management

https://radekmie.dev/blog/on-lazy-secrets-management/
1•thunderbong•11m ago•0 comments

Show HN: ZenLocks – A privacy-first, subscription-free iOS screen time blocker

https://zenlocks.haogre.com
1•haogre•11m ago•0 comments

I found a vulnerability in an IRS authorized e-file vendor's app. What's next?

2•kevinminehart•13m ago•0 comments

TheoremGraph: Search 18M+ Mathematical Dependencies

https://www.theoremsearch.com/theorem-graph
1•ilreb•14m ago•0 comments

AMD Versal Architecture and Product Data Sheet (New Premium Series Gen 2)

https://docs.amd.com/v/u/en-US/ds950-versal-overview
2•oneofthose•15m ago•2 comments

Herdr: One terminal for he whole herd

https://herdr.dev/
2•rldjbpin•16m ago•0 comments

Japan has 72 micro-seasons. In 2021 it stopped officially watching most of them

https://jivx.com/microseasons
3•momentmaker•19m ago•0 comments

Hunting a 16-year-old SQLite WAL bug with TLA+

https://ubuntu.com/blog/hunting-a-16-year-old-sqlite-bug-with-tla-is-dqlite-affected
2•peterparker204•21m ago•1 comments

Tokki – language learning app because Duolingo is useless

https://apps.apple.com/us/app/tokki-chat-learn/id6768467025
1•kozielgpc•22m ago•1 comments

Claude Code Is Quietly Fingerprinting China-Linked API Routers

https://www.vincentschmalbach.com/claude-code-china-router-fingerprint/
7•vincent_s•22m ago•0 comments

6 Months of Rift

https://monster0506.dev/blog/6-months-of-rift
1•Monster0506•25m ago•0 comments

I built a browser video editor where you can verify no footage is uploaded

https://Aethercut.app
1•AetherCut•25m ago•0 comments

Should every baby's DNA be sequenced?

https://www.economist.com/science-and-technology/2026/06/29/should-every-babys-dna-be-sequenced
7•nedruod•25m ago•4 comments

Coding with DeepSeek 4 on a 128GB MacBook Pro

https://ronreiter.com/posts/running-deepseek-v4-flash-locally/
2•ronreiter•26m ago•0 comments

We built the hackathon idea we gave up on in 2011

2•EngineeringStuf•26m ago•0 comments

Building tech in the secret R&D hub

https://www.technologyreview.com/2026/06/30/1139661/building-tech-in-the-worlds-secret-rd-hub/
1•joozio•27m ago•0 comments

Sony erases digital content from libraries; reminded we don't own what we buy

https://arstechnica.com/gadgets/2026/06/sony-erases-digital-content-from-libraries-were-reminded-...
25•pseudolus•27m ago•4 comments

Digiplot – automatically extract data from chart images with AI

https://digiplot.ai/
1•Jeremy_DH•28m ago•1 comments

Microsoft builds a bouncer to keep bots out of Teams meetings

https://www.theregister.com/software/2026/06/30/microsoft-builds-a-bouncer-to-keep-bots-out-of-te...
3•LorenDB•30m ago•0 comments

All you need is PostgreSQL

https://ebellani.github.io/blog/2026/all-you-need-is-postgresql/
1•schonfinkel•31m ago•0 comments

The .join() that should be a bug

https://kronotop.com/blog/the-join-that-should-be-a-bug/
1•mastabadtomm•32m ago•0 comments

Towards Automating Scientific Review with Google's Paper Assistant Tool

https://arxiv.org/abs/2606.28277
1•Anon84•33m ago•0 comments

DoorDash robot refuses to leave SWAT operation in Arizona

https://www.the-independent.com/news/world/americas/crime/doordash-robot-swat-operation-arizona-b...
4•pseudolus•35m ago•0 comments