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

Time Dilation Calculator – Multiple Languages

https://timedilationformula.com/en/
1•mpclarkson•2m ago•1 comments

Basis Universal v2

https://github.com/BinomialLLC/basis_universal
1•PaulHoule•2m ago•0 comments

Waymo raised $16B led by Sequoia, DST Global, and Dragoneer at a $126B valuation

https://www.bloomberg.com/news/articles/2026-02-02/waymo-raises-16-billion-from-alphabet-others-t...
1•donsupreme•3m ago•0 comments

Surviving the Streaming Dungeon with Kafka Queues

https://rion.io/2026/02/02/surviving-the-streaming-dungeon-with-kafka-queues/
1•rionmonster•5m ago•1 comments

Toronto, Rendered in Minecraft [video]

https://www.youtube.com/watch?v=8ZPRIkpeGi4
1•peteforde•5m ago•0 comments

Trump urges Republicans to 'take over' and 'nationalize' voting

https://abcnews.go.com/Politics/trump-urges-republicans-nationalize-voting/story?id=129793658
6•belter•8m ago•0 comments

The New Mexico cave expanding our search for alien life

https://www.bbc.com/future/article/20260130-how-deep-caves-are-transforming-our-search-for-extrat...
1•AareyBaba•9m ago•0 comments

Show HN: AuthFill – Verify your email with one click

https://authfill.com
2•soeckly•10m ago•0 comments

Top central banks forge ahead with closely watched cross-border payments testing

https://www.reuters.com/business/top-central-banks-forge-ahead-with-closely-watched-cross-border-...
1•rguiscard•11m ago•0 comments

Adobe Animate is shutting down next month

https://www.theverge.com/news/872731/adobe-animate-app-shutdown-date
1•bandrami•11m ago•0 comments

Supabase Misconfiguration Exposed Moltbook's API Keys; Two SQL Statements Could

https://www.telos-ai.org/blog/moltbook-security-nightmare
1•birdculture•14m ago•0 comments

Show HN: Private LLM UI (no account, no tracking)

https://wraith.sh
1•harbinger-sec•14m ago•0 comments

Chainguard admitted Factory 1.0 was "brittle."

https://thenewstack.io/chainguard-admitted-factory-1-0-was-brittle-heres-how-2-0-fixes-it/
1•CrankyBear•14m ago•0 comments

Notepad++ ss Chinese government hackers hijacked its software updates

https://techcrunch.com/2026/02/02/notepad-says-chinese-government-hackers-hijacked-its-software-u...
1•Cutlets•18m ago•0 comments

After 20 years in IT, I haul junk

https://650hauling.com
1•RomanPushkin•18m ago•1 comments

The Age of Earnware

https://forgonetokens.substack.com/p/the-age-of-earnware
1•csullivan510•19m ago•0 comments

Selfish AI

https://www.garfieldtech.com/blog/selfish-ai
1•cdrnsf•23m ago•0 comments

Future leakage in block-quantized attention

https://matx.com/research/leaky_quantization
1•jxmorris12•25m ago•0 comments

Using LaTeX is a great hack for generating PDFs with Claude Code

https://jngiam.bearblog.dev/latex-is-a-great-hack-for-generating-pdfs-with-claude-code/
1•jngiam1•29m ago•0 comments

Ask HN: Where have all the humans gone?

2•adrianwaj•29m ago•0 comments

Axiomeer – An open marketplace for AI agents

1•ujjwalreddyks•31m ago•0 comments

Bjarne's Last Stand: How the Father of C++ Is Fighting a Losing War Against Rust

https://lucisqr.substack.com/p/bjarnes-last-stand-how-the-father
1•firesteelrain•31m ago•0 comments

Show HN: YouTube Audio Library Previews [video]

https://www.youtube.com/watch?v=eoa9pwIr64g
1•cutandjoin•31m ago•0 comments

Show HN: X's API is finally pay-per-use so I built a CLI for AI agents (Skill)

https://skills.sh/alberduris/skills/x-twitter
1•alberduris•34m ago•0 comments

Al is killing programming and the Python community

https://www.reddit.com/r/Python/s/bIYkLZu9Se
10•Nash0x7e2•34m ago•3 comments

Only What Is Alive Can Be Conscious

https://www.noemamag.com/only-what-is-alive-can-be-conscious/
4•sonicrocketman•41m ago•0 comments

Kevin Kelly – The Singularity Is Always Near

https://kk.org/thetechnium/the-singularity/
1•rmason•41m ago•0 comments

I Hate Fish

https://randsinrepose.com/archives/i-hate-fish/
1•gukov•43m ago•0 comments

GitHub discusses giving maintainers control to disable PRs

https://github.com/orgs/community/discussions/185387
5•aofeisheng•44m ago•0 comments

OpenClaw users, what is your token spend?

1•8cvor6j844qw_d6•44m ago•1 comments