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

France murder trial complicated by twin brothers with same DNA

https://www.bbc.co.uk/news/articles/cn87l12e4xeo
1•zeristor•1m ago•0 comments

My advice to 6-18-year-olds who want to learn to program

https://michaeldoornbos.com/2026/02/03/my-advice-to-6-18-year-olds-who-want-to-learn-to-program/
1•AlexeyBrin•2m ago•0 comments

Show HN: My store was attacked, and Stripe finished the job

https://stripe.com/
1•Marocraft•3m ago•0 comments

My Second Brain Never Worked. Then I Gave It a Gardener

https://robdodson.me/posts/i-gave-my-second-brain-a-gardener/
1•robdodson•3m ago•0 comments

The Cult of Charvet

https://www.nytimes.com/2026/01/25/style/the-cult-of-charvet.html
1•bookofjoe•4m ago•1 comments

Japan's Controversial Shift Back to Nuclear Energy

https://oilprice.com/Alternative-Energy/Nuclear-Power/Inside-Japans-Controversial-Shift-Back-to-N...
2•PaulHoule•10m ago•0 comments

JSON-driven E2E test runner with built-in MCP server for Claude Code

https://github.com/fastslack/mtw-e2e-runner
1•fastslack•13m ago•1 comments

Asdwewrtr

https://gist.github.com/Hertisida
1•vikkymelani•15m ago•0 comments

Nonreciprocal wave-mediated interactions power a classical time crystal

https://arxiv.org/abs/2504.15495
1•rbanffy•17m ago•0 comments

What We've Been Building and Why

https://www.patrol6.com/blog/coming-out-of-stealth/
1•mooreds•18m ago•1 comments

The Importance of Physical Touch for Proving You're Human

https://bengoldhaber.substack.com/p/the-importance-of-physical-touch
1•lindowe•19m ago•0 comments

Show HN: A custom font that displays Cistercian numerals using ligatures

https://bobbiec.github.io/cistercian-font.html
1•bobbiechen•19m ago•0 comments

Show HN: Poisson – Chrome extension that buries your browsing in decoy traffic

https://github.com/Daring-Designs/poisson-extension
2•daringdesigns•21m ago•0 comments

Iranians plead with Trump not to negotiate with the Islamic Republic

https://www.iranintl.com/en/202602063431?source=share-link
3•ukblewis•22m ago•0 comments

Scientists discover 'levitating' time crystals that you can hold in your hand

https://phys.org/news/2026-02-scientists-levitating-crystals.html
1•rbanffy•23m ago•0 comments

LiteClient v0.13.0 (Added Workspace-Scoped Storage)

https://github.com/liteclienthq/liteclient/releases/tag/v0.13.0
1•liteclient•23m ago•0 comments

Show HN: Somna – Pattern recognition for your nervous system

https://meetsomna.com/
1•benhowdle•26m ago•0 comments

News sites are locking out the Internet Archive to stop AI crawling

https://theconversation.com/news-sites-are-locking-out-the-internet-archive-to-stop-ai-crawling-i...
3•geox•30m ago•1 comments

Lance table format explained with simple animations

https://tontinton.com/posts/lance/
2•wild_pointer•32m ago•0 comments

Scrapoxy – End of Life

https://scrapoxy.io/
1•ezekg•34m ago•0 comments

Reverse Engineering the Prom for the SGI O2

https://mattst88.com/blog/2026/02/08/Reverse_Engineering_the_PROM_for_the_SGI_O2/
12•mattst88•34m ago•2 comments

Tell HN: Apple Price Gouging

5•kingkongjaffa•35m ago•6 comments

Project 7

https://zenodo.org/records/18528539
1•KaoruAK•36m ago•0 comments

AI Orchestrators Decision Table

https://gist.github.com/maxim/c6ef7f7abd8e33ca846bb99aa9139602
1•hakunin•40m ago•0 comments

Show HN: Chief – Loop Claude Code through your tasks, one commit at a time

https://minicodemonkey.github.io/chief/
2•thecodemonkey•40m ago•0 comments

Windows PCs Fade Away

https://www.infoworld.com/article/4128164/windows-pcs-fade-away.html
1•Stratoscope•40m ago•0 comments

Linus Torvalds Confirms the Next Kernel Is Linux 7.0

https://www.phoronix.com/news/Linux-7.0-Is-Next
4•pella•43m ago•0 comments

100 Days to Offload

https://100daystooffload.com/
1•edent•47m ago•0 comments

Show HN: EasyMemory – Local-First Memory Layer for Chatbots and Agents

1•justvugg•51m ago•0 comments

Deel: You can build a Decacorn from your bedroom

https://twitter.com/bouazizalex/status/2020159203382550530
1•lleims•52m ago•0 comments