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?

Universal Ruler: Scale-Invariant Geometric Persistence

https://github.com/wwes4/Ouroboros
1•wwes369•48s ago•1 comments

A confession from a mainstream food delivery app engineer

https://www.reddit.com/r/confession/s/gbrh2zxeou
1•taurath•50s ago•0 comments

Show HN: Aurora-OS.js – a tiny OS-like desktop in JavaScript (try demo)

https://github.com/mental-os/Aurora-OS.js
1•mentalos•3m ago•0 comments

I'm a developer for a major food delivery app

https://old.reddit.com/r/confession/comments/1q1mzej/im_a_developer_for_a_major_food_delivery_app...
1•apayan•3m ago•1 comments

The promise of strangers talking democracy

https://penncapital-star.com/campaigns-elections/the-promise-of-strangers-talking-democracy/
1•neehao•10m ago•0 comments

Show HN: Runtime Kubernetes Compliance Engine (Policy as Data, No SCAP XML)

https://github.com/scanset/K8s-ESP-Reference-Implementation
1•scanset•13m ago•0 comments

ASCII Motion

https://ascii-motion.app/community
1•memalign•14m ago•0 comments

NameCheap revoked domain from project because they don't like their politics

https://twitter.com/receipts_lol/status/2006732606164152651
2•hgezim•19m ago•1 comments

Show HN: Gojju, a Fun Programming Language

https://hemanth.github.io/gojju/
2•init0•21m ago•0 comments

Reentrant locks considered harmful (2010)

https://groups.google.com/g/golang-nuts/c/XqW1qcuZgKg/m/Ui3nQkeLV80J
1•chriscbr•21m ago•0 comments

Billboard Bangladesh Music – EDM

https://billboard-bangladesh.odoo.com/blog/edm-news-4/history-of-electronic-music-in-bangladesh-7
1•billboardbd•23m ago•1 comments

Preliminary discussion of the logical design of an electronic computer (1946) [pdf]

https://www.ias.edu/sites/default/files/library/Prelim_Disc_Logical_Design.pdf
2•fanf2•32m ago•0 comments

Show HN: Why the Xbox boot animation Easter egg is (probably) unfindable

https://docs.google.com/document/d/e/2PACX-1vQ_JONRXaWNkWdts9gCEngXxDtVhf6ZFOaqB2Qv8X8SM-LrHTvSR6...
1•koof•33m ago•0 comments

Starlink to lower satellite orbits to avoid space debris

https://www.reuters.com/business/aerospace-defense/starlink-plans-lower-satellite-orbit-enhance-s...
4•davidst•34m ago•1 comments

2025: The Year in LLMs

https://werd.io/2025-the-year-in-llms/
1•roopeshv•34m ago•0 comments

'College dropout' has become the most coveted startup founder credential

https://techcrunch.com/2025/12/31/college-dropout-has-become-the-most-coveted-startup-founder-cre...
3•wahvinci•35m ago•0 comments

Show HN: Chimera Studio – A browser-based AI asset pipeline

https://chimera.qq-pwn.com/
1•qq-niklas•35m ago•0 comments

How to use AI to augment learning without losing critical thinking skills?

2•mintsuku•43m ago•1 comments

A rare cancer-fighting plant compound has been decoded

https://www.sciencedaily.com/releases/2025/12/251227082728.htm
2•ashishgupta2209•44m ago•0 comments

OpenAI faces a make-or-break year in 2026

https://www.economist.com/business/2025/12/29/openai-faces-a-make-or-break-year-in-2026
1•Austin_Conlon•45m ago•1 comments

AB316: No AI Scapegoating Allowed

https://shub.club/writings/2026/january/ab316/
3•forthwall•45m ago•1 comments

Proteus: The AI-native editor for multimodal creation

https://github.com/gezilinll/Proteus
1•gezilinll•48m ago•1 comments

Scientists Found a 'Yellow Brick Road' at the Bottom of the Ocean

https://www.sciencealert.com/scientists-found-a-yellow-brick-road-at-the-bottom-of-the-ocean
1•ranit•51m ago•0 comments

Xleak: Rust utility brings Excel spreadsheets to your command line

https://github.com/bgreenwell/xleak
1•quantummagic•55m ago•0 comments

My one-liner Linux Dropbox client

https://lpan.io/one-liner-dropbox-client/
1•keepamovin•55m ago•1 comments

Agloe, New York

https://en.wikipedia.org/wiki/Agloe,_New_York
1•thunderbong•59m ago•0 comments

Show HN: LeaveNote – A privacy-focused instant messaging QR code application

https://www.leavenote.me/
1•noteable•1h ago•0 comments

Coco: A simple stackless, single-threaded, and header-only C++20 coroutine lib

http://luajit.io:80/posts/coco-cpp20-coroutine/
1•kingluo•1h ago•0 comments

DHH is immortal, and costs $200M

https://danieltenner.com/dhh-is-immortal-and-costs-200-m/
4•walterbell•1h ago•1 comments

You Have Only X Years to Escape Permanent Moon Ownership

https://www.astralcodexten.com/p/you-have-only-x-years-to-escape-permanent
2•chhxdjsj•1h ago•0 comments