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

Google broke Play's in-app review library and hasn't fixed it for a week

https://issuetracker.google.com/issues/506844940
1•eu22•29s ago•1 comments

The Static Dynamic JVM – A Many Layered Dive [video]

https://www.youtube.com/watch?v=RCxYsdeglDA
1•matt_d•1m ago•0 comments

A Cloud Dos Brasileiros

https://guaracloud.com/
1•Vicbona•1m ago•0 comments

The Tragedy of Gethostbyname

https://ariadne.space/2022/03/26/the-tragedy-of-gethostbyname.html
1•signa11•3m ago•0 comments

The Steam Controller sold out in 30 minutes

https://www.pcgamer.com/hardware/controllers/the-steam-controller-sold-out-in-30-minutes-utterly-...
1•ortusdux•3m ago•0 comments

LLVM: Add support for poison-generating/UB-implying annotations

https://github.com/llvm/llvm-project/pull/195339
1•luu•5m ago•0 comments

Long Lake agrees to acquire Amex GBT in AI bet

https://www.amexglobalbusinesstravel.com/press-releases/long-lake-agrees-to-acquire-amex-gbt-with...
1•lord_sudo•6m ago•0 comments

The Biggest Animal Migration–and Few Outsiders Have Seen It

https://www.wsj.com/world/africa/worlds-biggest-animal-migration-great-nile-b67e3c0b
1•thm•6m ago•0 comments

Agents Are Thinking: A tiny project exploring text based thinking animations

https://www.threads.com/@theaicontinuum/post/DXniNvyDVQw
1•zane__chen•8m ago•0 comments

Don't prepone it – do the needful. 10 Indianisms we should all be using

https://www.theguardian.com/commentisfree/2016/jan/04/indian-english-phrases-indianisms-english-a...
1•kayo_20211030•10m ago•1 comments

What I Got Wrong Implementing Graph-Based Vector Search

https://dubeykartikay.com/posts/reading-algorithms-like-an-engineer/
1•dubeyKartikay•10m ago•0 comments

Microsoft Edge stores all passwords in memory in clear text, even when unused

https://twitter.com/L1v1ng0ffTh3L4N/status/2051308329880719730
3•cft•10m ago•0 comments

Robot-mediated haptic feedback outperforms vision in violin duo coordination

https://www.science.org/doi/10.1126/scirobotics.aeb1901
1•geox•10m ago•0 comments

Amazon Web Services' plan to make networking disappear

https://www.theregister.com/2026/05/04/amazon_web_services_cupertino_networking_lab/
1•Bender•11m ago•0 comments

In Investing, It's When You Start and When You Finish (2011)

https://archive.nytimes.com/www.nytimes.com/interactive/2011/01/02/business/20110102-metrics-grap...
1•downbad_•12m ago•1 comments

Rumor: Disney to Remove Star Wars Sequel Trilogy from Timeline

https://geeksandgamers.com/remove-star-wars-sequel-trilogy/
2•bilsbie•13m ago•0 comments

Usage-based pricing killing your vibe, here's how to roll your own local AI

https://www.theregister.com/2026/05/02/local_ai_coding_agents/
3•Bender•14m ago•0 comments

Show HN: USD Accounts for Pakistani Freelancers

https://www.rizqfinance.com/
1•pickleballcourt•15m ago•0 comments

Chevrolet Performance eCrate package (400v/200hp)

https://www.chevrolet.com/performance-parts/crate-engines/ecrate
1•mindcrime•16m ago•0 comments

Show HN: I built a personal finance projection tool after outgrowing Excel

https://fignis.io/
1•loroloko•18m ago•0 comments

Deadweight Cognitive Loss, Mass Incarceration, and the Case for Education Reform

https://papers.ssrn.com/sol3/papers.cfm?abstract_id=6613125
1•paulpauper•19m ago•0 comments

How A.I. Is Transforming China's Entertainment Industry

https://www.nytimes.com/2026/05/03/world/asia/china-microdrama-ai-backlash.html
2•paulpauper•19m ago•0 comments

Show HN: Isonq – PDF/DXF and STEP to shop quoting

https://isonq.com/demo
1•dantesmaghi•19m ago•1 comments

The Southern Poverty Law Center Indictment

https://marginalrevolution.com/marginalrevolution/2026/05/the-southern-poverty-law-center-indictm...
3•paulpauper•20m ago•0 comments

Wizards of the Coast declines to voluntarily recognize Magic Arena union

https://www.enworld.org/threads/wizards-of-the-coast-declines-to-voluntarily-recognize-magic-aren...
1•pavel_lishin•22m ago•0 comments

AI Has Made Memory Chips One of the Most Profitable Products

https://www.wsj.com/tech/ai-has-made-memory-chips-one-of-the-worlds-most-profitable-products-b062...
1•gmays•22m ago•0 comments

Infinite Image Grids Are Flat Toruses

https://seththompson.com/articles/infinite-image-grids
1•s3th•22m ago•0 comments

Individual knowledge wikis need a sharing system, here is an example

https://github.com/dpetryshchuk/atrium-init
2•dimapetryshchuk•22m ago•1 comments

Apple Plans to Let Users Build Their Own Passes in iOS 27 Wallet App

https://www.bloomberg.com/news/articles/2026-05-04/ios-27-features-apple-plans-to-let-users-build...
1•helsinkiandrew•24m ago•0 comments

Drawy, KDE's first infinite whiteboard app

https://prayag2.github.io/posts/meet-drawy/
2•p4bl0•25m ago•0 comments