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?

Show HN: The Strava for Reading

https://www.cogito-app.io
1•hugobeey•29s ago•0 comments

A giant succession wave is coming for family businesses

https://www.economist.com/interactive/business/2026/04/09/a-giant-succession-wave-is-coming-for-f...
1•gmays•1m ago•0 comments

Cursor Camp

https://neal.fun/cursor-camp/
1•meetpateltech•1m ago•0 comments

Show HN: TreasuryFlow – AI CFO that runs in your spreadsheet, from $49/mo

https://treasuryflow.pantollventures.com/from-bench
1•michaelgdwn•2m ago•1 comments

Ask HN: Mining Scientific Papers

1•davidbjaffe•3m ago•0 comments

Show HN: Is Opus Ok Today?

https://isopusok.today/
2•balajmarius•4m ago•0 comments

Dreamware, Judgeware, Actware

https://valand.dev/blog/post/dreamware-judgeware-actware
1•valand•5m ago•0 comments

Put it in pencil: NASA's Artemis III mission to launch no earlier than late 2027

https://arstechnica.com/space/2026/04/put-it-in-pencil-nasas-artemis-iii-mission-will-launch-no-e...
1•rbanffy•6m ago•0 comments

A billion miles in less than a decade: GM's Super Cruise reaches a milestone

https://arstechnica.com/cars/2026/04/gms-super-cruise-passes-a-billion-driven-miles-since-2017/
1•rbanffy•7m ago•1 comments

Ask HN: Is it still worth it to try to get a job in IT

3•morpheos137•7m ago•0 comments

BeddyColor – Free Printable Coloring Pages for Kids

https://beddycolor.com
1•yimiqidage001•7m ago•0 comments

Oil price jumps to $117 after reports of 'extended' Iran blockade

https://www.bbc.com/news/articles/cj4pxr0gr02o
3•tartoran•7m ago•0 comments

Designers Are Having Fun. Again

https://metedata.substack.com/p/010-designers-are-having-fun-again
1•young_mete•8m ago•0 comments

Show HN: Plume – One hand-picked word a day, with etymology and pronunciation

https://apps.apple.com/us/app/plume-word-of-the-day/id6762819388
1•claudiusa•8m ago•0 comments

Amazon is offering new OpenAI products on AWS

https://techcrunch.com/2026/04/28/amazon-is-already-offering-new-openai-products-on-aws/
2•Brajeshwar•9m ago•1 comments

Show HN: BlAST Engine: AST-free static analyzer to generate agents.md in CI pipe

https://github.com/squid-protocol/gitgalaxy
1•squid-protocol•9m ago•0 comments

Only Elon Musk can fire Elon Musk from SpaceX, filing shows

https://www.reuters.com/world/only-elon-musk-can-fire-elon-musk-spacex-filing-shows-2026-04-29/
7•spenvo•10m ago•1 comments

The Right Amount of Automation

https://joelholmes.dev/blog/2026-04-29-right-amount-of-automation/
1•holmes89•10m ago•0 comments

I built an open source Harvey/Legora in two weeks

https://mikeoss.com
1•willchennn•11m ago•1 comments

Examples: Replacing expensive SaaS with free tools?

https://www.measureboard.com
1•txscdn•11m ago•1 comments

Why are doctors so unwilling to run tests?

https://12gramsofcarbon.com/p/why-are-doctors-so-unwilling-to-run
3•theahura•12m ago•0 comments

Mosaic – conformance suite for AI memory trust primitives

https://github.com/upcomingsimplecoder/mosaic
1•Jedidiah37•12m ago•0 comments

VX6 now supports Windows 11 / Server 2022 with native transport

https://github.com/ethical-buddy/vx6
1•dailker•13m ago•0 comments

An open-source stethoscope that costs between $2.5 and $5 to produce

https://github.com/GliaX/Stethoscope
1•0x54MUR41•15m ago•0 comments

Lazy BDDs with eager literal differences

https://elixir-lang.org/blog/2026/03/19/lazy-bdds-with-eager-literal-differences/
1•andrewstetsenko•15m ago•0 comments

MarCognity-AI – epistemic layer for LLMs, runs locally, no API

https://github.com/elly99-AI/MarCognity-AI
1•elly-99•16m ago•0 comments

Launching Agentic Orchestration Platform (Open Source)

https://sinas.co/
1•wearebrain•16m ago•0 comments

OpenAI Sued by Seven Families over Mass Shooting Suspect's ChatGPT Use

https://www.wsj.com/us-news/openai-sued-by-seven-families-over-mass-shooting-suspects-chatgpt-use...
3•canjobear•19m ago•0 comments

A.I. Bots Told Scientists How to Make Biological Weapons

https://www.nytimes.com/2026/04/29/us/ai-chatbots-biological-weapons.html
2•dist-epoch•19m ago•0 comments

I Kind of Fixed My iCloud Photos Problem

https://pxlnv.com/blog/icloud-photos-followup/
1•speckx•19m ago•0 comments