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

Desugaring the Relationship Between Concrete and Abstract Syntax

https://thunderseethe.dev/posts/desugar-base/
1•PaulHoule•54s ago•0 comments

The Four-Language Waltz: A Tale of Allocators and Regret

https://xlii.space/eng/the-four-language-waltz-a-tale-of-allocators-and-regret/
1•xlii•1m ago•0 comments

FDA clears Caliway's trial of CBL-514 for localised fat reduction

https://www.clinicaltrialsarena.com/news/caliway-cbl-514/
1•daoboy•1m ago•1 comments

Syria has new banknotes. They have opted for colours and symbols

https://www.whitemad.pl/syria-ma-nowe-banknoty-postawili-na-kolory-i-symbole/
1•thomassmith65•1m ago•0 comments

From Zero to Rain: A Claude Code Case Study

https://pj4533.com/sigh/
1•pj4533•2m ago•1 comments

Elon Musk wants robots everywhere. China is making that a reality

https://www.cnbc.com/2025/12/30/elon-musk-wants-robots-everywhere-china-is-making-that-a-reality....
1•gmays•3m ago•0 comments

The Bayesian Geometry of Transformer Attention

https://arxiv.org/abs/2512.22471
1•samwillis•3m ago•1 comments

Amoskeag: Declarative OSS DSL for business rules

https://github.com/durableprogramming/amoskeag
1•djb-at-durable•6m ago•0 comments

Show HN: Bass Tab Maker

https://github.com/jareklupinski/tab-maker
1•jareklupinski•6m ago•0 comments

Musly – Open-Source Subsonic Client with Apple Music-Inspired UI

https://musly.devid.ink/
2•ddevid•6m ago•1 comments

Show HN: C-TURTL, a turtle graphics game

https://michae2.github.io/c-turtl/
1•michae2•7m ago•0 comments

Make your CSS match your Android theme on Firefox

https://material.khaleelgibran.com
1•khalby786•9m ago•0 comments

Atoqu – A Zero‑Dependency, GPU‑Accelerated Search Engine Core

1•JavadInteger•9m ago•0 comments

Ask HN: A self populating task list

1•Vishal19111999•10m ago•0 comments

Learn X in Y Minutes

https://learnxinyminutes.com/
1•rramadass•10m ago•1 comments

Breaking Rust – Walk My Walk [AI Generated Song] [video]

https://www.youtube.com/watch?v=6Sb1Nvi7oQs
1•amichail•11m ago•0 comments

DHS Says DHS-Certified Real IDs Too Unreliable to Confirm U.S. Citizenship

https://reason.com/2025/12/31/dhs-says-real-id-which-dhs-certifies-is-too-unreliable-to-confirm-u...
11•xenophonf•12m ago•2 comments

Show HN: mac-cleanup-go – an interactive macOS cleanup tool

https://github.com/2ykwang/mac-cleanup-go
1•immutable000•13m ago•0 comments

This Year in Spring – December 30th, 2025

https://spring.io/blog/2025/12/30/this-year-in-spring-december-30th-2025/
1•saikatsg•15m ago•0 comments

Centralizing third-party SaaS dependency status – good idea or bad idea?

https://depsy.io
1•bellahadid•17m ago•1 comments

Show HN: DroidDock – Browse Android files on Mac with a Finder-like experience

https://rajivm1991.github.io/DroidDock/releases/v0.2.1.html
2•rajivm1991•18m ago•0 comments

The Most Important Truth in Human Discourse, per ChatGPT

https://zenodo.org/records/18116708
1•DavidWishengrad•20m ago•2 comments

Prototype demo: visualizing cognitive state during AI interaction [video]

https://www.youtube.com/watch?v=Rlsx1PaclI8
1•shine1697•20m ago•0 comments

Fixing Linux Kernel Bugs with LLMs

https://grimridge.net/blog/llm-linux-kernel/
1•WadeGrimridge•26m ago•0 comments

The Sexual Paradise that never was

https://quillette.com/2025/12/30/the-sexual-paradise-that-never-was-margaret-mead-samoa/
1•cjauvin•27m ago•0 comments

Sony PS5 ROM keys leaked – jailbreaking could be made easier with BootROM codes

https://www.tomshardware.com/video-games/playstation/playstation-5-rom-keys-leaked-jailbreaking-c...
21•gloxkiqcza•30m ago•0 comments

Dinner for One

https://en.wikipedia.org/wiki/Dinner_for_One
1•doener•31m ago•0 comments

Show HN: Enforcing Safe RSC Boundaries

https://github.com/yuuichieguchi/capsule-rsc
1•yuu1ch13•31m ago•0 comments

Challenging projects every programmer should try

https://austinhenley.com/blog/challengingprojects.html
1•Rexxar•32m ago•0 comments

There is room for imperfect fault isolation

https://pithlessly.github.io/correctness
2•todsacerdoti•32m ago•0 comments