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

Selecting the Right AI Evals Tool

https://hamel.dev/blog/posts/eval-tools/
1•saikatsg•1m ago•0 comments

Social Media Without Socializing

https://pluralistic.net/2026/01/19/billionaire-solipsism/#sirius-cybernetics
1•WillDaSilva•1m ago•0 comments

The unreasonable effectiveness of pattern matching

https://arxiv.org/abs/2601.11432
1•headalgorithm•1m ago•0 comments

What are the 'anti-coercion' instruments EU capitals may use against Trump?

https://www.reuters.com/markets/europe/eus-nuclear-option-moves-against-trump-tariff-threat-2025-...
1•u1hcw9nx•2m ago•0 comments

Show HN: A React state profiler used to find double-render bugs in Excalidraw

https://github.com/liovic/react-state-basis
1•lpetronika•2m ago•1 comments

My Fitbit Buzzed and I Understood Enshittification

https://tidyfirst.substack.com/p/my-fitbit-buzzed-and-i-understood
1•vips7L•2m ago•0 comments

Train Ralph Like an ML Model

https://softwaredoug.com/blog/2026/01/17/ai-coding-needs-test-train-splits
1•softwaredoug•3m ago•0 comments

Show HN: PixelBank – Learn computer vision with code

https://pixelbank.dev
1•ksal15•3m ago•0 comments

The Problem with AI Flattering Us

https://time.com/7346052/problem-ai-flattering-us/
1•voxleone•3m ago•0 comments

Nonviolence

https://kinginstitute.stanford.edu/nonviolence
3•rkp8000•4m ago•0 comments

Lightweight Compression in DuckDB (2022)

https://duckdb.org/2022/10/28/lightweight-compression
1•tosh•4m ago•0 comments

Show HN: A low-latency LaTeX editor focused on writing flow

https://doccollab-29n2zip5g-doccollab.vercel.app/
1•Nilmar•5m ago•0 comments

How Does the Hive Mind Work in Pluribus?

https://www.wired.com/story/how-does-the-hive-mind-work-in-pluribus/
1•saikatsg•5m ago•0 comments

The Bet on Juniors Just Got Better

https://tidyfirst.substack.com/p/the-bet-on-juniors-just-got-better
2•vips7L•6m ago•0 comments

Show HN: Silent Channel – A serverless P2P messenger using manual WebRTC

https://silent-channel.do.am/
1•lordtao•7m ago•0 comments

AI pairing engine auto-extracts menus for personalized coffee-pastry experience

https://coffee.io
1•christian_gral•8m ago•1 comments

Pomegranate Protection Against Cardiovascular Diseases

https://onlinelibrary.wiley.com/doi/10.1155/2012/382763
1•bilsbie•9m ago•0 comments

Certificate Transparency Info Leaks

https://latedeployment.github.io/posts/certificate-transparency-info-leaks/
1•elegantgate•10m ago•0 comments

Show HN: CervellaSwarm – The only AI coding team that checks its own work

https://github.com/rafapra3008/CervellaSwarm
1•rafapra•10m ago•1 comments

WTF is happening at xAI [video]

https://www.youtube.com/watch?v=8jN60eJr4Ps
1•lexandstuff•12m ago•0 comments

Show HN: Dead or Alive – Daily celebrity mortality guessing game

https://deadoralive.today
1•docnavy•12m ago•0 comments

Show HN: Heroshot – Screenshot Automation CLI

https://heroshot.sh
1•machala•12m ago•0 comments

Chief Wiggum: Ralph Wiggum coding agent coordinator

https://github.com/0kenx/chief-wiggum
1•0kenx•13m ago•1 comments

Why I Stopped Using Nbdev

https://hamel.dev/blog/posts/ai-stack/
3•enzojean•14m ago•0 comments

Norm-Preserving Biprojected Abliteration

https://huggingface.co/blog/grimjim/norm-preserving-biprojected-abliteration
1•lobo_tuerto•16m ago•0 comments

Why everyone suddenly wants Greenland (2024) [video]

https://youtu.be/sxRdKRORYoA
2•teleforce•16m ago•0 comments

Show HN: Shrp – Free AI writing tools, no signup required

https://shrp.app
1•digi_wares•17m ago•0 comments

Run Maestro Mobile App Tests on Physical iOS Devices

https://testingbot.com/blog/maestro-physical-device-testing
1•defied•17m ago•0 comments

Cosmos is an operating system development kit

https://www.gocosmos.org/
1•doener•18m ago•0 comments

Why Observability Requires a Distributed Column Store (2021)

https://www.honeycomb.io/blog/why-observability-requires-distributed-column-store
1•tosh•18m ago•0 comments