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

Epsteincoin Is Collapsing

1•zerosizedweasle•6m ago•0 comments

Would you choose the Microsoft stack today if starting greenfield?

1•JB_5000•6m ago•0 comments

What's the right trust model for an agent-to-agent network?

https://platia.ai/
1•alexandroskyr•7m ago•1 comments

IBM stock drops by 13% after Anthropic publishes a blog post

https://www.businessinsider.com/ibm-stock-price-anthropic-ai-update-cobol-language-software-sello...
2•seagram•10m ago•0 comments

Uber acquiring parking app SpotHero as it moves beyond ride-hailing

https://www.cnbc.com/2026/02/23/uber-acquiring-spothero.html
1•avonmach•10m ago•0 comments

Show HN: LexReviewer – Because "Chat with PDF" is broken for legal workflows

https://github.com/LexStack-AI/LexReviewer
1•sherebanuk•12m ago•1 comments

Strategic choices: When both options are good

https://longform.asmartbear.com/strategic-choices/
1•doppp•13m ago•0 comments

Why is the toilet often called the debug chair?

https://blog.ptidej.net/debug-chair/
1•yann-gael•13m ago•0 comments

Intel XeSS 3: expanded support for Core Ultra/Core Ultra 2 and Arc A, B series

https://www.intel.com/content/www/us/en/download/785597/intel-arc-graphics-windows.html
2•nateb2022•13m ago•0 comments

Railway surpasses 1M deployments per day

https://railway.com/stats
1•dban•14m ago•0 comments

An Open Fan Differs from Turboprop and How It Beats Turbofans [video]

https://www.youtube.com/watch?v=fT7Zi_xF8Ts
1•sxzygz•15m ago•0 comments

FreeBSD 2025 Q4 Status Report

https://www.freebsd.org/status/report-2025-10-2025-12/
1•vermaden•15m ago•0 comments

United States Withdrawal from the Joint Comprehensive Plan of Action

https://en.wikipedia.org/wiki/United_States_withdrawal_from_the_Joint_Comprehensive_Plan_of_Action
2•treetalker•19m ago•0 comments

Show HN: LookTake – Try anyone's makeup, outfit, or hairstyle on your photo

https://about.looktake.io/
1•takeaura25•20m ago•0 comments

Debunking Cato's "Immigrants Use Less Welfare" Claim

https://samuelgabrielsg.substack.com/p/debunking-catos-immigrants-use-less
1•samuelgabrielsg•20m ago•0 comments

NASA will return its moon rocket to the hangar for more repairs before astronaut

https://phys.org/news/2026-02-nasa-moon-rocket-hangar-astronauts.html
3•bookmtn•22m ago•0 comments

VidSoda is an all-in-one AI creative platform

https://vidsoda.com/
1•nikiki•24m ago•1 comments

Proposal limiting foreign scientists at NIST disrupts Colorado quantum industry

https://coloradosun.com/2026/02/19/colorado-quantum-industry-scientists-foreign-nist-federal-labs/
3•osnium123•24m ago•0 comments

Lamborghini cancels their multi-year EV project

https://www.engadget.com/transportation/evs/lamborghini-ditches-plans-for-its-all-electric-superc...
4•dreadsword•26m ago•2 comments

The Weird OS Built Around a Database [video]

https://www.youtube.com/watch?v=pWZBQMRmW7k
1•surprisetalk•26m ago•0 comments

Record-breaking Antarctic drill reveals 23M years of climate history

https://phys.org/news/2026-02-antarctic-drill-reveals-million-years.html
3•wglb•27m ago•1 comments

The AI productivity boom is not here (yet)

https://www.economist.com/finance-and-economics/2026/02/22/the-ai-productivity-boom-is-not-here-yet
6•andsoitis•29m ago•3 comments

NPM install is stealing your passwords – I built a tool to catch it

https://westbayberry.com/product
2•ComCat•32m ago•1 comments

Lamplight.Cafe

https://lamplight.cafe
2•ryuura•33m ago•0 comments

NASA's Artemis II launch date gets pushed back again

https://qz.com/nasas-artemis-ii-launch-delayed-april
2•bookmtn•36m ago•0 comments

Show HN: MFLScout – Analytics Platform for Metaverse Football League

1•iedayan03•36m ago•0 comments

Claude on Socialization

https://claude.ai/share/486be97b-df4f-4e11-abc9-53021038f141
1•s1gs3gv•38m ago•1 comments

Show HN: CodeAnswr – AI-powered Stack Overflow alternative, free forever

https://codeanswr.com
1•mobinpo•40m ago•1 comments

Show HN: BudgetFast – Upload a bank statement screenshot, AI does the rest

https://budgetfast.co
1•ivanramos•40m ago•0 comments

I made a game about the nihilist penguin

https://store.steampowered.com/app/4343410/ULTRATAP_Demo/
1•luckyape_•44m ago•0 comments