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•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?

A Brief, Incomplete, and Mostly Wrong History of Programming Languages (2009)

http://james-iry.blogspot.com/2009/05/brief-incomplete-and-mostly-wrong.html
1•azhenley•1m ago•0 comments

Company Blew $500M on Claude AI in One Month Due to No Usage Limit on Licenses

https://www.gadgetreview.com/company-blew-500m-on-claude-ai-in-one-month
1•dotcoma•4m ago•0 comments

Nvidia says it has largely conceded China's AI chip market to Huawei

https://www.cnbc.com/2026/05/21/nvidia-jensen-huang-china-ai-chip-market-huawei.html
1•KnuthIsGod•9m ago•0 comments

Company accidentally blows $500M on Claude AI in one month

https://www.msn.com/en-us/news/technology/company-accidentally-blows-500-000-000-on-claude-ai-in-...
5•galaxyLogic•10m ago•0 comments

Show HN: Clinglang – A shorthand language for doctors to write structured cases

https://github.com/ppnpm/clinlang
1•ppnpm•22m ago•0 comments

OpenRCT2 v0.5.1 "Swamp Castle" released Last version to support Windows 7

https://openrct2.io/blog/2026/05/openrct2-v0.5.1-released
2•jandeboevrie•25m ago•0 comments

Guitar Tools – PWA for Scales, Circle of Fifths and More

https://guitar-tools.eejalab.xyz/
3•hannofcart•26m ago•1 comments

Sleuths uncover 100 suspicious images in Thermo Fisher antibody catalogue

https://www.nature.com/articles/d41586-026-01706-2
1•Teever•29m ago•0 comments

Cathy Tie's mission to genetically modify babies

https://www.theguardian.com/science/2026/may/30/there-is-no-way-to-stop-this-biotech-barbie-cathy...
1•skruger•37m ago•0 comments

Boom shakes S Carolina, rattling Columbia and raising questions about the cause

https://www.thestate.com/news/local/environment/article315932620.html
2•thunderbong•44m ago•0 comments

Show HN: I built an Android OS in the browser

https://mobilegym.dev/
1•haozaz•45m ago•0 comments

A Weekend in Claude Design Saves 3 Weeks of Claude Code

https://cashandcache.substack.com/p/the-prototype-tax-how-a-weekend-in
2•binyu•51m ago•0 comments

The 12 Futures of AI

https://medium.com/@butsch_79/the-12-futures-of-ai-a42d67bd9a20
1•andsoitis•53m ago•0 comments

The Biggest Tell That Something Was Written by AI

https://www.theatlantic.com/technology/2026/05/how-to-tell-ai-writing/687345/
5•nlawalker•54m ago•3 comments

Indian court ruling on Google keyword ads could reshape online advertising

https://www.reuters.com/business/media-telecom/indian-court-ruling-google-keyword-ads-could-resha...
1•rustoo•55m ago•0 comments

The next frontier of the luxury airline arms race might be waged in the toilet

https://www.cnn.com/travel/first-class-toilets-emirates-airbus-travel-intl-spc
2•tomodachi94•55m ago•0 comments

Poor sleep linked to rising cancer risk in under-50s

https://www.theguardian.com/society/2026/may/30/poor-sleep-linked-rising-cancer-risk-under-50s
1•andsoitis•59m ago•1 comments

Records Show UC Sharing Data with US Customs and Border Protection

https://www.dailycal.org/news/uc/records-show-uc-sharing-data-with-us-customs-and-border-protecti...
14•computerliker•1h ago•0 comments

Ask HN: What could happen if human beings become obsolete?

4•baddash•1h ago•2 comments

HeavensLive: The Marketplace That Gives You Free Money to Start – No Strings

https://www.heavenslive.com
1•bbenevolence•1h ago•0 comments

Mean Hand

https://portfolio.anna-zhang.com/projects/mean-hand
2•sdrothrock•1h ago•0 comments

Farewell AWS

https://www.adventuresinoss.com/farewell-aws/
2•cafkafk•1h ago•0 comments

An Usable Minimal Programming Language?

https://github.com/las-r/aergia
1•las_r•1h ago•1 comments

Ask HN: Why I have such bad luck?

2•alonsovm44•1h ago•0 comments

Vercel Analytics Alternative When You Outgrow the Free Tier

https://raah.dev/blog/vercel-analytics-alternative
1•Arindam1729•1h ago•0 comments

Show HN: NoTime – a Firefox extension for one-sentence summaries

https://addons.mozilla.org/en-US/firefox/addon/no-time/
1•dh1011•1h ago•1 comments

China's world-beating solar industry is in turmoil

https://economist.com/china/2026/05/26/chinas-world-beating-solar-industry-is-in-turmoil
3•andsoitis•1h ago•1 comments

SpaceX and the 'Enshittification' of Markets

https://www.ft.com/content/f724d500-fd45-4f38-86b8-549b5cae88ba
3•petethomas•1h ago•0 comments

Treasury Sec Bessent says US Government has seized $1B of Iran's crypto

https://twitter.com/bitcoinmagazine/status/2060442288598155762
1•computerliker•1h ago•0 comments

The Orchestration Tax

https://addyosmani.com/blog/orchestration-tax/
1•jnakano89•1h ago•0 comments