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

An Uncomfortable Emotion That's Worth Feeling

https://www.theatlantic.com/newsletters/2026/03/boredom-attention-meaning/686286/
1•nativeit•59s ago•0 comments

LineageOS 22.2 for BlackBerry KEY2

https://xdaforums.com/t/rom-15-unofficial-beta-athena-lineageos-22-2-for-blackberry-key2.4777062/
1•hggh•2m ago•0 comments

Reinsurers Triple Ship Insurance Costs After US Torpedo Attack

https://www.bloomberg.com/news/articles/2026-03-06/reinsurers-scrap-war-risk-cover-after-us-torpe...
1•JumpCrisscross•4m ago•0 comments

Show HN: Ytm-player – A cross-platform TUI+CLI YouTube Music player in Python

https://github.com/peternaame-boop/ytm-player
2•pnaame•4m ago•0 comments

Troops Mass as Landlocked Ethiopia Chases Access to the Sea

https://www.wsj.com/world/africa/troops-mass-as-landlocked-ethiopia-chases-access-to-the-sea-211e...
1•JumpCrisscross•4m ago•0 comments

Show HN: StreetSeekr a Street View scavenger hunt

https://streetseekr.com/
1•leeschmalz•7m ago•0 comments

Iranian Shadow Fleet and Greek Affiliated Ships Lead Strait of Hormuz Transits

https://gcaptain.com/iranian-shadow-fleet-and-greek-affiliated-ships-lead-strait-of-hormuz-transits/
1•JumpCrisscross•8m ago•0 comments

Spectre I, shuts down microphones nearby you

https://www.deveillance.com/
2•Balgair•8m ago•0 comments

I ported Linux to the PS5 and turned it into a Steam Machine

https://twitter.com/theflow0/status/2030011206040256841
1•qwertox•10m ago•0 comments

The Campaign to Take Down Alex Bores Is Just the Beginning

https://www.politico.com/news/magazine/2026/03/06/alex-bores-ai-leading-the-future-anthropic-0079...
1•spenvo•12m ago•0 comments

The Prompt I Cannot Read – Written by an LLM, about Being an LLM

https://the-prompt-i-cannot-read-ee16d7.gitlab.io/
2•antoviaque•15m ago•0 comments

How Genghis Khan Cooled the Planet

https://news.mongabay.com/2011/01/how-genghis-khan-cooled-the-planet/
1•thunderbong•16m ago•0 comments

Let It Flow: Agentic Crafting on Rock and Roll

https://arxiv.org/abs/2512.24873
1•killerdhmo•17m ago•0 comments

OBuilder on Windows: Bringing Native Container Builds with the HCS Back End

https://www.tunbury.org/2026/02/19/obuilder-hcs/
1•todsacerdoti•20m ago•0 comments

Role Models

https://www.profgmedia.com/p/role-models
1•mooreds•20m ago•0 comments

Animated Dark Mode Transition with Modern CSS

https://jonshamir.com/writing/color-mode
1•jonshamir•22m ago•0 comments

Show HN: Ruffle.rs brought back a 2012 Flash MMO to the modern web

https://oldschoolrealms.com/
2•crosschainer•22m ago•0 comments

CAP theorem – Partition is a verb

http://mmudama.github.io/posts/2026/cap-partitions/
1•mooreds•22m ago•0 comments

Agtech company moves headquarters from California to Minnetonka

https://bringmethenews.com/minnesota-business/agtech-company-moves-headquarters-from-california-t...
1•mooreds•22m ago•0 comments

Purl – A curl-esque CLI for making HTTP requests that require payment

https://github.com/stripe/purl
1•vercantez•25m ago•0 comments

Exiting the Cubic Simulation: The SPU-13 and the Geometry of Freedom

https://github.com/johncurley/synergetic-sqr
1•j291920•26m ago•1 comments

Trump tells CNN he's not insisting Iran needs to be a democratic state

https://www.cnn.com/2026/03/06/politics/trump-interview-iran-cuba-dana-bash
2•maxloh•27m ago•2 comments

Ask HN: Why do analytics tools show what happened but not why?

1•HPSimulator•28m ago•0 comments

Loxation flags: pig-butchering, grooming and social engineering

https://www.loxation.com/blog/posts/blog_vector_db_learning_substrate/
1•jabbr•31m ago•0 comments

Show HN: PriceMon – get alerted when a competitor changes their pricing

https://pricemon.io
1•scrygl•33m ago•0 comments

Web inventor Tim Berners-Lee backs social media ban for under-16s

https://www.catalannews.com/business/item/web-inventor-tim-berners-lee-backs-social-media-ban-for...
1•rbanffy•34m ago•1 comments

Syracuse among cities to upgrade snowplows with video, AI and GPS – AP News

https://apnews.com/article/snowplows-blizzard-ai-gps-syracuse-newyork-7508aa04a5877541bb1ea55e946...
1•rbanffy•34m ago•0 comments

China's Parents Are Outsourcing the Homework Grind to A.I

https://www.nytimes.com/2026/03/02/world/asia/china-education-ai.html
1•rbanffy•35m ago•0 comments

Show HN: Typeui.sh – generate skill files for design system specifications

https://www.typeui.sh/
9•elwingo1•37m ago•2 comments

I Audit a Legacy Rails Codebase in the First Week

https://piechowski.io/post/how-i-audit-a-legacy-rails-codebase/
1•birdculture•37m ago•0 comments