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

0.12949 This is not randomness this is Determinism HST

https://github.com/sel8888/harmonic-shape-transform-2026-koncept
1•sel8888•4m ago•0 comments

The Era of the Tiger Mom Is Over. Enter the Beta Mom

https://www.wsj.com/lifestyle/relationships/beta-moms-influencers-tiktok-6cf99674
2•huhkerrf•7m ago•0 comments

Show HN: WfmOxide a Rust parser (.wfm/.isf) with CLI and time axis

https://github.com/SGavrl/WfmOxide
1•Galo43•10m ago•0 comments

FreeBSD – A Lesson in Poor Defaults

https://vez.mrsk.me/freebsd-defaults
1•jruohonen•11m ago•0 comments

Bill Gates' Mosquito Factory in Colombia and Its Contribution to Health

https://aldianews.com/en/wellness/investigation/gates-mosquito-factory
2•thunderbong•20m ago•0 comments

Lego raises age limit to 100 for David Attenborough's birthday

https://www.instagram.com/p/DYCw8KIlaDJ/
2•Brajeshwar•24m ago•1 comments

AI Act Article 50 transparency rules. Heading for another cookie consent moment?

https://digital-strategy.ec.europa.eu/en/library/draft-guidelines-implementation-transparency-obl...
2•nilen•31m ago•0 comments

Simpler Agent Orchestration WTF

https://alokit.substack.com/p/the-number-nobody-runs-before-building
1•avikalp•32m ago•1 comments

Foo on You, Asparagirl! (2002)

http://esr.ibiblio.org/?p=112
2•jruohonen•36m ago•0 comments

I made a better viewer for the WAR.GOV/UFO Files

https://hypergrid.systems/site/
2•keepamovin•36m ago•0 comments

Open-source Express.js dev panel for routes and request logs

https://www.npmjs.com/package/express-dev-panel
1•dvsxdev•39m ago•0 comments

Engineering as Humanity's Highest Achievement

https://walkingtheworld.substack.com/p/engineering-as-humanitys-highest
1•hermitcrab•45m ago•0 comments

Three Cultures of Math

https://rkirov.github.io/posts/three-cultures-of-math/
1•mathgenius•46m ago•0 comments

Chess.com produces 3500 ton of CO2 in air for loading JavaScript bundles

https://www.chess.com/
1•emifo3•48m ago•5 comments

Mlx-serve – run LLMs natively on your Mac

https://ddalcu.github.io/mlx-serve/
1•wrxd•50m ago•0 comments

Outlook on Windows silently scales your email by 1.5×

http://picmel.com/blog/outlook-dpi-scaling-bug
2•rudixworld•50m ago•0 comments

Show HN: Query years of HN discussions and comments as a knowledge graph

https://github.com/hash-anu/lightrag-snkv
1•swaminarayan•51m ago•0 comments

AI cost optimization tool "distillfast.com"

2•ashuashpawar•59m ago•2 comments

UtaForth – 303-byte 16-bit Forth in pure Netwide Assembler

https://github.com/Fuwn/UtaForth
2•irdc•1h ago•1 comments

LLMs Won't Replace Programming Languages

https://mech-lang.org/post/2025-01-09-programming-chatgpt/
1•tosh•1h ago•0 comments

Rotten Dot Com

https://www.theparisreview.org/blog/2026/05/06/rotten-dot-com/
45•lordgrenville•1h ago•25 comments

Machine Learning Offers Faster, More Reliable Analysis of Fermi Surfaces

https://www.tus.ac.jp/en/mediarelations/archive/20260417_0478.html
1•rustoo•1h ago•0 comments

Arm, the UK and Apple

https://thechipletter.substack.com/p/arm-the-uk-and-apple
2•klelatti•1h ago•0 comments

LLMorphism: When humans come to see themselves as language models

https://arxiv.org/abs/2605.05419
3•okey•1h ago•0 comments

Real signals or artificial stereotypes? Adventures with a cultural Copilot

https://kucharski.substack.com/p/real-signals-or-artificial-stereotypes
2•ceejayoz•1h ago•0 comments

In a quest to becoming AI independent

https://adlrocha.substack.com/p/adlrocha-in-a-quest-to-becoming-ai
6•adlrocha•1h ago•1 comments

Show HN: Tinyblok – publishes conditioned sensor data to NATS from an ESP32

https://github.com/lexvicacom/tinyblok
2•alexjreid•1h ago•0 comments

RISC-V Serial Debug Protocol Specification (Draft)

https://gitlab.com/lauterbach/riscv-rsdp-spec
2•jonesjohnson•1h ago•0 comments

Gen Z Resentment Toward AI Grows as Adoption Stagnates and Workplace Fears Mount

https://www.waltonfamilyfoundation.org/about-us/newsroom/gen-z-resentment-toward-ai-grows-as-adop...
6•mgh2•1h ago•0 comments

Eve

https://witheve.com/
3•tosh•1h ago•0 comments