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?

Ericsson Silent Layoffs in the US

1•allabouttech•36s ago•0 comments

Trump Moves to Make Tech Giants Pay for Surging Power Costs

https://www.bloomberg.com/news/articles/2026-01-15/trump-to-direct-key-us-grid-operator-to-hold-e...
1•jmcdonald-ut•40s ago•0 comments

America's Throwaway Spies: How the CIA Failed Iranian Informants in Tehran

https://www.reuters.com/investigates/special-report/usa-spies-iran/
1•koolhead17•1m ago•0 comments

Mark Carney and Xi Jinping meet to mend ties as Donald Trump disrupts globe

https://www.ft.com/content/9eeff245-2081-4f97-bc8e-6bbdaf59074e
2•KnuthIsGod•4m ago•0 comments

Fontello – Combine icon webfonts for your own project

https://github.com/fontello/fontello
1•doodlesdev•5m ago•0 comments

Is there any way we can help Stack Overflow Website get back up?

https://stackoverflow.com/questions/79867766/is-there-any-way-we-can-help-stack-overflow-website-...
1•nomilk•5m ago•0 comments

AI as a Compression Problem

https://dkg.fifthhorseman.net/blog/2025-ai-and-compression.html
1•pabs3•6m ago•0 comments

PanoptiCity – interactive map reveals the scale of mass surveillance worldwide

https://panopticity.fr/
1•pabs3•7m ago•0 comments

How Safe Is the Rust Ecosystem? A Deep Dive into Crates.io

https://mr-leshiy-blog.web.app/blog/crates_io_analysis/
1•RustSupremacist•12m ago•0 comments

Trump accepts Nobel Peace medal from Venezuelan opposition leader

https://www.smh.com.au/world/north-america/venezuelan-opposition-leader-says-she-presented-trump-...
2•KnuthIsGod•12m ago•2 comments

Gen X and Millennials Will Inherit Trillions in Real Estate over the Next Decade

https://www.wsj.com/real-estate/luxury-homes/millennial-genx-inherit-real-estate-wealth-d78b4454
1•alephnerd•17m ago•1 comments

From AI agent prototype to product: Lessons from building AWS DevOps Agent

https://aws.amazon.com/blogs/devops/from-ai-agent-prototype-to-product-lessons-from-building-aws-...
1•malahay•21m ago•1 comments

TranslateGemma: A new suite of open translation models

https://blog.google/innovation-and-ai/technology/developers-tools/translategemma/
2•anigbrowl•21m ago•0 comments

Show HN: Buildzr: Python DSL for Authoring C4 Models

https://github.com/amirulmenjeni/buildzr
1•amenji•23m ago•0 comments

Apple's Tactics Could Prevent Japan from Improving Browser Competition

https://open-web-advocacy.org/blog/how_apples_key_tactic_could_prevent_japans_smartphone_act_from...
1•donohoe•26m ago•0 comments

Boeing knew of flaw in part linked to UPS plane crash

https://www.bbc.com/news/articles/cly56w0p9e1o
14•1659447091•29m ago•1 comments

Microsoft Xbox Manufacturing in 2002

https://www.youtube.com/watch?v=YeQrQYFVlXA
1•guidedlight•31m ago•0 comments

Image FX – Free One-Click AI Photo Editor and Image Generator

https://image-fx.app
1•julian2026•31m ago•0 comments

European Alternatives for Digital Products

https://european-alternatives.eu
1•memset•33m ago•0 comments

Show HN: Dev Utility Hub – Client-side only developer tools (JSON, JWT, Cron)

1•hun-ing•36m ago•0 comments

vLLM-MLX – Run LLMs on Mac at 464 tok/s

https://github.com/waybarrios/vllm-mlx
2•waybarrios•42m ago•1 comments

Ericsson Doing Quiet Layoffs

5•allabouttech•43m ago•0 comments

Noninvasive brain treatment for depression proves helpful

https://www.cnn.com/2026/01/15/health/saint-tms-depression-therapy-wellness
5•1659447091•44m ago•0 comments

How to Speak LLM

https://chuanqisun.github.io/how-to-speak-llm/
1•osmoscraft•44m ago•0 comments

Cryptography 30 years apart: Ascon on an HP-16C

https://dram.page/p/ascon-hp16c/
2•todsacerdoti•47m ago•0 comments

Show HN: OneView – One-page website builder you can share OR embed anywhere

https://www.oneview.work/en
1•fengs•50m ago•0 comments

My Projects in 2025

https://simonhartcher.com/posts/2026-01-16-my-projects-in-2025/
2•deevus•50m ago•1 comments

Predictions for the New Year

https://lwn.net/Articles/1052269/
1•signa11•51m ago•0 comments

Hytale Calculator

https://hytalecalculator.com/
4•quchao•51m ago•1 comments

After Hostile Takeover Fail, Ellison's Paramount Skydance Sues WBD Netflix

https://finance.yahoo.com/news/failed-hostile-takeover-bid-david-023115712.html
7•stopbulying•53m ago•2 comments