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?

PostHog's MCP SDK asks agents to explain why they call each tool

https://posthog.com/docs/mcp-analytics/intent
1•akshay2603•3m ago•1 comments

HumanFish: Predicting Who Wins a Human Chess Game

https://humanfish.vercel.app/methodology
1•oli5679•3m ago•0 comments

Netherlands Internet Status

1•nobeh•8m ago•1 comments

Show HN: Best Black Friday SaaS Deals (Mega List)

https://www.blackfridaydeals.directory/
2•bfdd•11m ago•0 comments

Ask HN: Best Gmail Alternative (looking for an excellent spam filter)

1•ethor•13m ago•0 comments

Open letter asking the EU for real browser competition on iOS

https://action.open-web-advocacy.org/
1•DavideNL•18m ago•0 comments

$140k in debt to Google cloud due to AI token usage. any ideas?

1•ro-han_solo•19m ago•0 comments

Forty-One Years at Sea

https://www.projectnothing.ai/essays/forty-one-years-at-sea
1•erikrothoff•19m ago•0 comments

Who gets to decide if something is written by AI?

https://www.seangoedecke.com/who-gets-to-decide-if-something-is-written-by-ai/
1•Jasonsf737•20m ago•0 comments

I Still Believe in Mentorship

https://endler.dev/2026/why-i-still-believe-in-mentorship/
1•fagnerbrack•23m ago•1 comments

How to Read Paintings

https://howtoreadpaintings.com/
1•akashwadhwani35•25m ago•0 comments

There's a rumor going around that P=BQP has been proven

https://www.reddit.com/r/mathematics/comments/1y6i062/theres_a_rumor_going_around_that_pbqp_has_b...
4•personjerry•28m ago•0 comments

The Auden Course: Who could survive such a feast?

https://hedgehogreview.com/issues/reality-and-its-alternatives/articles/the-auden-course
1•maxall4•29m ago•0 comments

Mark to Swap: How the Market Is Mispricing the AI Boom

https://www.groundbrkr.com/p/mark-to-swap-how-the-market-is-mispricing
1•mudil•29m ago•0 comments

Ladybird browser's first downloadable alpha is surprisingly capable

https://arstechnica.com/gadgets/2026/11/ladybirds-new-alpha-shows-theres-life-beyond-chromium/
8•bryanrasmussen•29m ago•0 comments

The group chat where your AI talks behind your back

https://construct22.com/
27•utiiiD•39m ago•6 comments

Ask HN: Would you care for more than 2FA for any of your accounts?

2•sandeepkd•44m ago•0 comments

Gta VI on VIctory – Low-VRAM Laptop Fork (RTX 2050 4 GB / 16 GB RAM)

https://github.com/avelone123123/VIctory
5•avelone•47m ago•0 comments

S&P Warns Nvidia's Board May Be Compromised

https://www.usnews.com/news/top-news/articles/2026-11-25/us-finds-no-evidence-china-directed-exec...
5•signa11•49m ago•0 comments

Undercard Physics Boxing

https://count10.itch.io/undercard
1•royraghav28•51m ago•1 comments

An Overview of the Aeneas Rust Verification Toolchain

https://www.sonho.fr//2026/03/18/aeneas-overview.html
2•plumeria•57m ago•0 comments

Beattape.ai – Lofi Psychedelic Nostalgia

https://beattape.ai/
3•pj4533•1h ago•1 comments

Show HN: Liora Tools – 100% client-side browser utilities in 6 languages

https://www.lioratools.com
1•ryomasakamoto•1h ago•0 comments

Soda Stallion Peak Review: Benefits, Features and Key Details

https://open.spotify.com/episode/0oKBBLJCfHDf4n8d7C3Jk3
1•JanEricksonn•1h ago•1 comments

Crab Mentality

https://en.wikipedia.org/wiki/Crab_mentality
6•chistev•1h ago•0 comments

We trained time-series AI models on AWS Trainium2, 2x cheaper than H200s

https://twitter.com/martinmaritsch/status/2126195898795573437
1•masquare•1h ago•0 comments

Leveling up game development for a good cause

https://antigravity.google/blog/leveling-up-game-development-for-a-good-cause/
2•saikatsg•1h ago•0 comments

Browser tabs as a container runtime – Farid Zakaria's Blog

https://fzakaria.com/2026/11/25/browser-tabs-as-a-container-runtime
4•RebelPotato•1h ago•0 comments

Ask HN: How well do you understand what's going on inside RL?

8•natsu529•1h ago•5 comments

The AI labs are rumored to have results relevant to crypto

https://twitter.com/secparam/status/2126079107817787693
1•justusw•1h ago•1 comments