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?

Show HN: An AI video prompt cookbook for image-to-video workflows

https://github.com/yasuomang/ai-video-prompt-cookbook
1•Ash_yasuomang•51s ago•0 comments

100 Greatest Bird Names of All Time

https://birdhistory.substack.com/p/the-100-greatest-bird-names-of-all
1•bookofjoe•3m ago•0 comments

Show HN: AdvertBench, ranking the ability of LLMs to create image ads

https://advertbench.com
1•joegibbs•4m ago•0 comments

How LLMs Distort Our Written Language

https://sites.google.com/view/llmwritingdistortion/home
1•jruohonen•4m ago•0 comments

Show HN: An agentic control pane for iPhone

https://onepilotapp.com
2•elearia•6m ago•0 comments

Show HN: Local LLM Hardware Calculator

https://vettedconsumer.com/can-i-run-it/
1•ermantrout•7m ago•0 comments

Show HN: GraphCompose – Declarative Java engine for structured business PDFs

https://github.com/DemchaAV/GraphCompose
2•demchaav•12m ago•0 comments

The Mathematics of the Chinese Calendar [pdf]

https://gwern.net/doc/science/physics/astronomy/2010-aslaksen.pdf
3•mysticaltech-•13m ago•0 comments

Foreign-Born Entrepreneurs Drive America's Unicorn Boom

https://news.crunchbase.com/venture/foreign-born-entrepreneurs-drive-americas-unicorn-boom-strebu...
2•USTECH_WORKER•16m ago•1 comments

Beyond All Reason (Free Total Annihilation Inspired RTS)

https://www.beyondallreason.info
3•mosiuerbarso•16m ago•0 comments

Shall We? – A pre-engineering sanity check for AI-era feature bloat

https://github.com/Tacsiazuma/shall-we
3•tacsiazuma•17m ago•0 comments

Tell HN: Happy Father's Day

3•atestu•20m ago•0 comments

AI Warfare Is at the Point of No Return

https://www.wsj.com/world/ai-warfare-ukraine-russia-anthropic-29945df9
1•bookofjoe•22m ago•1 comments

Retrocomputing with Clash – Haskell for FPGA Hardware Design

https://unsafeperform.io/retroclash/
3•AlexeyBrin•24m ago•0 comments

Madrid Metro uses its trains to deliver packages during non-operating hours [video]

https://www.youtube.com/watch?v=xyuxZCxHWzA
2•cromka•26m ago•1 comments

If anyone wants user feedback directly from your product website, check this out

https://amendor.site/
1•osaeld•29m ago•0 comments

Computer Programming for Everybody

https://www.python.org/doc/essays/cp4e/
2•edent•29m ago•0 comments

A Wild Register Appears: Hunting the 30-Year-Old World of Xeen MT-32 Crash

http://finalpatch.github.io/xeen/
2•stevekemp•30m ago•0 comments

I aim to break the record for the fastest mile

https://www.telegraph.co.uk/athletics/2026/06/09/josh-kerr-why-im-trying-break-record-fastest-mil...
2•wjb3•30m ago•0 comments

Cagebase - Chromium fork that spoofs fingerprints from a JSON profile

1•boredhacker3•31m ago•1 comments

I Created a Minimalist Universal Language for AI

https://github.com/caihongfairys/QMP-Dynamic-Anchors
2•Queen_Xiya•31m ago•0 comments

The open-source Agent Communication Infrastructure

https://github.com/novuhq/novu
2•scopsy•33m ago•0 comments

The Vagabundler Project

https://vagabundler.com/about-vagabundler/
1•jruohonen•34m ago•0 comments

Firecracker-like microVMs for Proxmox VE – KVM isolation, under 200 ms boot

https://github.com/rcarmo/pve-microvm
2•networked•36m ago•0 comments

Local Chrome Bookmarking Extension

https://chromewebstore.google.com/detail/bookmarks-default/mfilaenpdpjhpmchhoboaekjdpmmeckc
1•alikatyc•37m ago•1 comments

Talked with the TerraSpark CEO, they are completely crazy

https://www.terraspark.energy/
2•GL26•37m ago•3 comments

Are Transformers Turing-Complete? A Good Disguise Is All You Need

https://lifeiscomputation.com/transformers-are-not-turing-complete/
4•paraschopra•43m ago•0 comments

Agent Privacy

https://blog.jackdavis.net/ai/security/2026/06/16/agent-privacy-research-writeup.html
2•JackDDavis•45m ago•0 comments

How websites know where you are

https://geospoof.com/blog/how-websites-know-your-location
2•sgro•46m ago•0 comments

The case against geometric algebra

https://alexkritchevsky.com/2024/02/28/geometric-algebra.html
1•Hbruz0•47m ago•0 comments