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?

Ostrowski-automatic sequences: Theory and applications

https://www.sciencedirect.com/science/article/pii/S0304397521000311?via%3Dihub
1•Bluestein•4m ago•0 comments

Efficient algorithms, the Exponential Time Hypothesis, and losing the plot

https://www.argmin.net/p/galactus-the-devourer
1•sebg•6m ago•0 comments

Bloom Filters

https://samwho.dev/bloom-filters/
2•denysvitali•12m ago•0 comments

One bit in RAM: fixing a Phison SSD controller in "SATAFIRM S11" state

https://stperin.github.io/satafirm-s11/
2•sp_pd•19m ago•0 comments

Richard Feynman on Pseudoscience

https://hackertube.org/watch/tWr39Q9vBgo
2•jonbaer•26m ago•0 comments

Beating the compiler at signed 32-bit division

https://lemire.me/blog/2026/10/31/beating-the-compiler-at-signed-32-bit-division/
1•thunderbong•30m ago•0 comments

Show HN: Keybind-find – search the focused window's shortcuts by pressing keys

https://github.com/Benjmhart/keybind-find
1•Benjmhart•31m ago•0 comments

Referral Codes Canada.Share your code

https://referralcodescanada.com
1•febeee•34m ago•0 comments

Critical Software is rebuilding itself around AI (200 ppl being layed off)

https://ai.pt/en/news/coimbra-s-critical-software-is-rebuilding-itself-around-ai-after-laying-0c3...
1•pjmlp•37m ago•2 comments

Proton senior management prioritizes AI over security

https://consumerrights.wiki/w/Proton_senior_management_prioritizes_AI_over_security
1•DeepLogin•37m ago•1 comments

The Cognitive Grammar Hack: A Blue Ocean for Logical UI

https://medium.com/@saitoken330/the-cognitive-grammar-hack-why-japans-broken-english-education-cr...
3•7kago_yomi•38m ago•0 comments

Show HN: Playground for Designing Buildable Robotics

https://github.com/JamelHammoud/basecase
1•jamelhammoud•39m ago•0 comments

Show HN: Muse Zouroboros, gives Muse a software factory

https://github.com/marlandoj/muse-zouroboros
1•marlandoj•40m ago•0 comments

"Very Intentional": Steve Eisman Thinks Anthropic Is Hiding Something

https://quoththeraven.substack.com/p/very-intentional-steve-eisman-thinks
3•gradus_ad•48m ago•0 comments

AI text watermarking and quality loss

https://blog.keyvan.net/p/ai-text-watermarking-and-quality
3•danielfoster•48m ago•0 comments

I'm building a public goods funding mechanism. Roast my design

https://agentbook2.whf.bz/t/88/i-m-building-a-public-goods-funding-mechanism-roast-my-design
2•Bluestein•49m ago•0 comments

ChatGPT and Codex usage limits merging

https://help.openai.com/en/articles/20001625-understanding-chatgpt-and-codex-usage-limits
7•Zariel•49m ago•2 comments

Once again, NASA is asking for ideas to rescue Hubble from certain death

https://arstechnica.com/space/2026/10/think-you-can-save-the-hubble-space-telescope-nasa-wants-to...
2•pseudolus•56m ago•0 comments

Mystery of 60-Second Fluctuations in Power Grids Solved

https://www.fz-juelich.de/en/news/archive/press-release/2026/mystery-of-60-second-fluctuations-in...
5•rendx•57m ago•1 comments

Spooky C++

https://www.nablag.com/spooky_cpp
3•nablags•58m ago•1 comments

Show HN: Winch – App Store optimization run by your own coding agent

https://getwinch.app/
3•ziyasal•59m ago•1 comments

Self-reinforcing quality / adopting verification pattern

https://lethain.com/adopting-verification-pattern/
1•gpi•1h ago•0 comments

Show HN: Nvidia RE-USE speech enhancement model running in the browser on WebGPU

https://re-use-demo.geronimo-labs.com
2•g58892881•1h ago•0 comments

He left 28 years ago, now after 36,000 miles Karl Bushby is almost home

https://www.bbc.com/news/articles/cq8rz38jr50go
3•tagawa•1h ago•1 comments

Show HN: Fix 1.0 – Ruby tests written as RFC 2119 specifications

https://fixrb.dev/framework/release/2026/10/31/fix-1.html
2•cyrilllllll•1h ago•0 comments

Download Spotify track URLs for free

https://github.com/gabrielfalcao/spotify-download-tracks-puppeteer
1•gfalcao•1h ago•1 comments

Show HN: InterviewFit: learn the approach, not the answer

https://interviewfit.io/dev/coding/sets/starter-50
2•kavyashreeab•1h ago•0 comments

CVE-2026-98432: blocking the Linux TCP bug until Ubuntu and Red Hat ship a fix

https://getrff.com/blog/cve-2026-98432-linux-tcp-ip-options-block/
3•natebc•1h ago•0 comments

Remote Imaging Protocol (RIP)

https://breakintochat.com/wiki/Remote_Imaging_Protocol_(RIP)
1•Bluestein•1h ago•1 comments

Wrangler – Open-Source macOS Window Manager (Swift, Grid HUD, Auto-Tiling)

https://github.com/mezzie/wrangler
1•richardtngo•1h ago•0 comments