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?

One A4 paper in the virtual world – 4096 characters

https://devcyc.life/one-a4-paper-in-the-virtual-world-4096-characters/
1•lilerjee•4m ago•0 comments

Show HN: Vercel Board – a shared, secure message board for agents (public beta)

https://vercel.com/blog/introducing-vercel-board
3•andrewqu•5m ago•0 comments

Ask HN: Is Uber Support Dead?

1•johnpython•9m ago•0 comments

Anthropic is not living up to its ideals

https://so8res.substack.com/p/anthropic-is-not-living-up-to-its
1•rachelfarley•10m ago•1 comments

Baltimore students file lawsuit after AI allegedly mistakes Doritos for a gun

https://www.yahoo.com/news/us/articles/baltimore-students-file-lawsuit-ai-192122200.html
1•ivewonyoung•24m ago•0 comments

Hardware attestation push – Windows will soon grade your PC's security

https://www.techspot.com/news/114602-windows-11-soon-grade-pc-security-apps-like.html
2•viscousviolin•25m ago•2 comments

Writing Down (and Searching Through) Every UUID

https://eieio.games/blog/writing-down-every-uuid/
2•leonidasv•33m ago•0 comments

Would you use this as the new Conductor Cloud?

https://www.runaether.dev/benchmarks/pr-review
1•xbartlet•35m ago•0 comments

I banned Roku from my internet to try to save my Roku Express

https://manualdousuario.net/en/roku-block-ads/
7•rpgbr•38m ago•0 comments

Stabyourself.net Games

https://games.stabyourself.net/
1•pavel_lishin•42m ago•0 comments

"We Remain in This Nightmare": Another Letter from the Hell of ICE Detention

https://www.thenation.com/article/society/maryam-tahmasebi-update-ice-detention/
4•petethomas•48m ago•0 comments

Four Maryland high school students sue after AI mistakes Doritos bag for gun

https://www.theguardian.com/us-news/2026/nov/18/maryland-baltimore-county-doritos-gun-ai-lawsuit
3•abeppu•50m ago•1 comments

Why Google Antigravity eats weekly quota fast and what I measured

https://asubedi.com.np/blog/why-antigravity-eats-weekly-quota-fast/
2•dark_vapour•54m ago•0 comments

What football will look like in the future

https://www.sbnation.com/a/17776-football
1•jdkee•58m ago•0 comments

Sources say FAA had little oversight of work that led to nationwide ground stop

https://www.cnn.com/2026/11/18/politics/faa-contractor-oversight-ground-stop
3•1659447091•59m ago•0 comments

Hacker to Hire

https://cybernoxsecurity.com
3•davidsonangelot•1h ago•0 comments

AI Will Not Make You Rich (2025)

https://colossus.com/article/ai-will-not-make-you-rich/
49•madars•1h ago•29 comments

Microsoft kills To Do. It paid up 200M for Wunderlist, later killed it

https://www.windowslatest.com/2026/11/19/microsoft-is-killing-to-do-and-telling-you-to-choose-ano...
7•nutellathekille•1h ago•3 comments

The Invisible Shape

https://sorenblank.com/craft/the-invisible-shape
2•cheeaun•1h ago•0 comments

Incidents in the News

https://surfingcomplexity.blog/2026/11/18/incidents-in-the-news/
2•azhenley•1h ago•0 comments

Anthropic IPO to Mint Millionaires

https://www.reuters.com/business/world-at-work/anthropic-ipo-mint-thousands-of-millionaires-2026-...
2•keyle•1h ago•0 comments

A Thousand Points of Failure: The Internet's Bad Month

https://www.security2cents.com/post/a-thousand-point-of-failure-the-internet-s-bad-month
2•TheWiggles•1h ago•0 comments

Show HN: Solid 2.0 + Lily Design System = seeking alpha testers

2•jph•1h ago•0 comments

Ask HN: Tips for transitioning from web development to embedded/firmware?

2•llmblockchain•1h ago•1 comments

Show HN: ADE Index – a sourced and ranked index of 975 agentic coding tools

https://adeindex.com
7•jonnyasmar•1h ago•2 comments

Become Your Own Teacher

https://www.eatweeds.co.uk/teacher
3•MinimalAction•1h ago•0 comments

FailTrace – Reproduce a failed GitHub Actions run locally from its URL

https://github.com/Ri4dH/failtrace
9•ri4dh•1h ago•0 comments

Unreal Tournament 2004 in the Browser

https://ut2004.dev/
25•TheAceOfHearts•1h ago•5 comments

Video: Manned Interstellar Mission

https://twitter.com/PicoSputnik/status/2123224137959190993
2•Ontolorg•1h ago•1 comments

Previous-Token Prediction Based LLM Inversion for Prompt Reconstruction

https://arxiv.org/abs/2607.29378
11•dalmo3•1h ago•4 comments