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?

The Startup Making Human Embryos with AI-Assisted Robots

https://www.bloomberg.com/news/features/2026-01-09/conceivable-wants-embryo-making-robots-to-tran...
1•NewCzech•2m ago•0 comments

Revolutionizing Accreted Systems

https://gleasonalia.com/posts/001-revolutionizing-accreted-systems/
1•gpi•3m ago•0 comments

Opinion: Why did Apple ditch OpenAI for Google

https://www.crnasia.com/news/2026/artificial-intelligence/apple-ditches-openai-for-google
1•fork-bomber•5m ago•0 comments

I got tired of collecting emails for Secret Santa, so I built this

1•xiaolu627•6m ago•0 comments

Chromium Has Merged JpegXL

https://chromium-review.googlesource.com/c/chromium/src/+/7184969
1•thunderbong•6m ago•0 comments

GeoParquet Downloader for QGIS

https://github.com/cholmes/qgis_plugin_gpq_downloader
1•marklit•8m ago•0 comments

Dynamicland Nonprofit Narrative (2020) [pdf]

https://dynamicland.org/2020/Nonprofit_narrative.pdf
1•phronmophobic•9m ago•0 comments

Why posting MORE content DOESN'T mean more reach on X

https://medium.com/@loganholdsworth/why-posting-more-content-doesnt-mean-more-reach-on-x-bfc94923...
1•boyodestroyer•12m ago•0 comments

Investigating if gut health affects aging: could I hack my own gut to age better

https://www.bbc.com/news/articles/c1m8m47jl5eo
1•1659447091•13m ago•0 comments

Solving Factorio with Terraform [video]

https://www.youtube.com/watch?v=uU06vKlCNXk
1•NicolasCornwall•13m ago•0 comments

Using CORS and Google Sheets is the cheapest way to implement a waitlist

https://medium.com/@taninsea/using-cors-google-sheets-is-the-cheapest-way-to-implement-a-waitlist...
1•tanin•18m ago•0 comments

Terminal Control Library for Odin Language

https://github.com/RaphGL/TermCL
1•fork-bomber•20m ago•0 comments

Indian PSLV satellite launcher fails for the second time in a row

https://www.space.com/space-exploration/launches-spacecraft/india-eos-n1-military-satellite-15-pa...
3•Guestmodinfo•23m ago•0 comments

Hi HN, I'm Bikram a Developer from Bihar, India

https://www.earthbornbarsoi.in/
2•Vikkyv•23m ago•0 comments

Lot of insights: The biggest mistakes I've made with Lunch Money – Jen

https://lunchbag.ca/lunch-money-mistakes/
1•Mehuleo•28m ago•0 comments

Show HN: Incus-Sandbox-SDK

https://github.com/divyenduz/incus-sandbox-sdk
1•divyenduz•28m ago•1 comments

Higher daylight exposure improves cognitive performance, study finds

https://www.manchester.ac.uk/about/news/higher-daylight-exposure-improves-cognitive-performance-s...
2•XzetaU8•30m ago•0 comments

AI can now 'see' optical illusions. What does it tell us about our own brains?

https://www.bbc.com/future/article/20251218-how-ai-is-shedding-new-light-on-optical-illusions
2•vinni2•34m ago•0 comments

Phind Is Shutting Down

http://phind.com/
4•deepdude•35m ago•2 comments

Elon Musk says saving for retirement is irrelevant: 'It won't matter'

https://finance.yahoo.com/news/elon-musk-says-saving-retirement-221451637.html
1•quantified•36m ago•2 comments

Claude Cowork first impression: Cowork Deleted 11GB of files [video]

https://www.youtube.com/watch?v=_6C9nMvQsGU
4•virgildotcodes•37m ago•1 comments

Detecting MIME Types in Go

https://rnemeth90.github.io/posts/2024-03-27-golang-detect-file-type/
1•todsacerdoti•37m ago•0 comments

QGIS – a geographic information system software that is free and open-source

https://www.qgis.org/
1•merusame•40m ago•0 comments

A 3D-printed watch-cleaning machine

https://adventuresinamateurwatchfettling.com/2025/04/11/a-3d-printed-watch-cleaning-machine/
1•tagawa•42m ago•0 comments

Atlas: An Analytical Topology of Logic, Aims, and Structure

https://zenodo.org/records/18226093
1•takko_the_boss•43m ago•0 comments

A Plea for Silicon Valley to Enter Politics

https://loeber.substack.com/p/30-a-plea-for-silicon-valley-to-enter
1•barry-cotter•48m ago•1 comments

Show HN: A script that turns 365 photos into a square year poster

https://github.com/0plus1/oneyear
1•0plus1•55m ago•0 comments

Missed Connections NYC [video]

https://www.youtube.com/shorts/anRJ_aQzfRQ
2•low_tech_punk•55m ago•0 comments

Bohemian Tragedy: the SF-based society may have logged its old-growth forest

https://archive.vanityfair.com/article/share/895a393a-52cc-46f5-a055-404e91c291bf
2•wahnfrieden•57m ago•0 comments

OpenCode-Container

https://git.jeena.net/jeena/opencode-container
1•jeena•57m ago•1 comments