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

CV-go-fast – A minimalist, high-speed CV builder with no tracking

https://cv-go-fast.netlify.app/
1•RunTimeZero•53s ago•0 comments

US GLP-1 spending went from $57M to $71.7B in 5 years. We modeled what's next

https://andrewrexroad.substack.com/p/issue-7-the-glp-1-gold-rush
2•rexroad•1m ago•0 comments

The Moon Just Got a New Scar

https://www.universetoday.com/articles/the-moon-just-got-a-new-scar
2•johnbarron•2m ago•0 comments

Why children become fussy eaters

https://economist.com/culture/2026/04/09/why-children-become-fussy-eatersfrom
2•andsoitis•2m ago•0 comments

Claude Changes My Code

https://alexcbecker.net/blog/how-claude-changes-coding.html
1•alexbecker•2m ago•0 comments

Hungary's Orban, a Beacon to the Right Wing, Concedes Election Defeat

https://www.nytimes.com/2026/04/12/world/europe/hungary-election-orban-magyar.html
4•doener•5m ago•2 comments

Are landline phones making a comeback? [video]

https://www.bbc.com/reel/video/p0ncdtb6/watch
3•devonnull•5m ago•0 comments

What Claude Code's Source Revealed About AI Engineering Culture

https://techtrenches.dev/p/the-snake-that-ate-itself-what-claude
1•cyb_•7m ago•0 comments

Basics of Radar Technology

https://www.radartutorial.eu/index.en.html
1•_Microft•7m ago•0 comments

US Route 66 Marks 100 Years: Cruising America's Main Street

https://apnews.com/projects/us-route-66-marks-100-years/
1•NaOH•8m ago•0 comments

Show HN: Posse – A Web UI for Claude Managed Agents

https://github.com/oguzbilgic/posse
1•obilgic•12m ago•0 comments

Google Removes "Doki Doki Literature Club" from Google Play

https://bsky.app/profile/serenityforge.com/post/3mj3r4nbiws2t
3•super256•15m ago•0 comments

Tracking down a 25% Regression on LLVM RISC-V

https://blog.kaving.me/blog/tracking-down-a-25-regression-on-llvm-risc-v/
1•luu•16m ago•0 comments

Catch Me – Juggling by Taylor Glenn (2018) [video]

https://www.youtube.com/watch?v=xD8E33P1Nb4
2•KolmogorovComp•16m ago•0 comments

PostGIS for PGlite

https://www.npmjs.com/package/@electric-sql/pglite-postgis
1•tdrz•17m ago•1 comments

European AI. A playbook to own it. By Mistral

https://europe.mistral.ai/
16•hjouneau•17m ago•1 comments

One DNA letter can trigger complete sex reversal

https://www.eurekalert.org/news-releases/1122852
3•gmays•19m ago•0 comments

The Madman Walked into His Own Trap

https://medium.com/@megam226/the-madman-walked-into-his-own-trap-1592a65b34b1
1•megam226•19m ago•0 comments

Show HN: Stork – MCP server so Claude/Cursor can search 14k MCP servers AI tools

https://www.stork.ai
1•usestork•19m ago•0 comments

Self-evolving daemon that 'dreams' about your codebase at night for AI agents

https://github.com/juyterman1000/entroly/
1•abbyedd•21m ago•0 comments

HUMANS.md

https://josem.co/humans.md/
1•josem•21m ago•0 comments

Footbag Patterns

http://www.footbag.org/footbags/patterns/
1•helterskelter•22m ago•0 comments

Staged homes sell for more than empty homes

https://marginalrevolution.com/marginalrevolution/2026/04/staged-homes-sell-for-more-than-empty-h...
1•neehao•22m ago•0 comments

Mutually Automated Destruction: The Escalating Global A.I. Arms Race

https://www.nytimes.com/2026/04/12/technology/china-russia-us-ai-weapons.html
1•johnbarron•23m ago•0 comments

Major European polluter EPH corporation hides over half its carbon emissions

https://denikreferendum.cz/clanek/238763-kretinskys-eph-corporation-hides-over-half-its-carbon-em...
1•kukakike•23m ago•0 comments

The Peril of Laziness Lost

https://bcantrill.dtrace.org/2026/04/12/the-peril-of-laziness-lost/
6•gpm•24m ago•0 comments

Rankle

https://github.com/semperos/rankle/blob/master/Rankle.ipynb
1•tosh•27m ago•0 comments

The Longest Outdoor Escalator Just Opened in China

https://www.smithsonianmag.com/smart-news/the-worlds-longest-outdoor-escalator-just-opened-in-chi...
1•mooreds•27m ago•0 comments

Terraform Versioning Guide

https://masterpoint.io/blog/ultimate-terraform-versioning-guide/
2•mooreds•28m ago•0 comments

'Witness Tampering'?: Live Nation Demands Sanctions Against State Plaintiffs

https://www.law.com/newyorklawjournal/2026/04/07/witness-tampering-live-nation-demands-sanctions-...
1•1vuio0pswjnm7•28m ago•0 comments