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

Sally Rooney books may be withdrawn from UK sale over Palestine Action ban

https://www.bbc.com/news/articles/cm20ldz0g9ro
1•clanky•6m ago•0 comments

Mission home invasion highlights danger of crypto-related violence

https://sfstandard.com/2025/11/25/mission-home-invasion-highlights-danger-crypto-related-violence/
1•JumpCrisscross•7m ago•0 comments

A Programmer-Friendly I/O Abstraction Over io_uring and kqueue

https://tigerbeetle.com/blog/2022-11-23-a-friendly-abstraction-over-iouring-and-kqueue/
1•enz•7m ago•0 comments

AI Tool to Discover Expert Scientists

https://www.scientistfinder.ai/
1•Tardigrade10•12m ago•0 comments

Lung Cancer Deaths Prevented and Life-Years Gained from Lung Cancer Screening

https://jamanetwork.com/journals/jama/fullarticle/2841694
1•JumpCrisscross•14m ago•1 comments

Evidently 0.7.17: open-source LLM tracing and dataset management

https://www.evidentlyai.com/blog/open-source-llm-tracing
1•ashvardanian•17m ago•0 comments

Tesla Model Y Is the Most Defective Car This Year, Germany Says

https://www.jalopnik.com/2035447/tesla-model-y-most-defective-car-in-germany/
6•doener•17m ago•0 comments

Germany's Plan for War with Russia

https://www.wsj.com/world/europe/germany-russia-war-nato-secret-plan-8ce43a8d
3•perihelions•18m ago•2 comments

External looping pattern for Claude Code – apply one task to N inputs

https://github.com/kanatti/claude-code-external-loop
2•bkanattil•25m ago•0 comments

Show HN: I built a free astro and tailwind static site for GitHub pages

https://tariqdude.github.io/Github-Pages-Project-v1/
1•chiengineer•31m ago•0 comments

A macOS Window Manager Inspired by FancyZones on Windows

https://bentoboxapp.com/
1•alexktz•31m ago•0 comments

Kobo Articles Proxy – use Kobo Instapaper integration, without using Instapaper

https://github.com/marklar423/kobo-pocket-proxy
1•Curiositry•32m ago•0 comments

CXMT unveils DDR5-8000 and LPDDR5X-10667 chips

https://www.tomshardware.com/pc-components/dram/chinas-banned-memory-maker-cxmt-unveils-surprisin...
3•vkaku•37m ago•1 comments

Built an AI agent that creates block code

https://huggingface.co/spaces/MCP-1st-Birthday/MCP-Blockly
1•owenkaplinsky•38m ago•1 comments

Bauble

https://bauble.studio/
1•phaser•39m ago•0 comments

Using game engines to train robotics, AV models, and AI pilots

https://alanscottencinas.medium.com/how-early-digital-systems-quietly-shaped-the-minds-building-t...
2•encinas88•44m ago•0 comments

Ask HN: Vandy grad seeking HN community's career advice

1•shannonalp•45m ago•0 comments

Textshader

https://textshader.com/
2•memalign•45m ago•0 comments

Show HN: Deploy Next.js to your own VPS via a lightweight agent

https://outlap.dev
1•ben_hrris•47m ago•1 comments

'Algospeak' is changing our language in real time (2022)

https://www.washingtonpost.com/technology/2022/04/08/algospeak-tiktok-le-dollar-bean/
1•thunderbong•48m ago•0 comments

Data Science Weekly – Issue 627

https://datascienceweekly.substack.com/p/data-science-weekly-issue-627
2•sebg•49m ago•0 comments

What Is HATEOAS?

https://blog.hmpl-lang.dev/2025/11/27/what-is-hateoas/
1•aanthonymax•52m ago•0 comments

Canada signs pipeline deal that could reverse oil tanker ban

https://apnews.com/article/canada-oil-pipeline-alberta-oil-british-columbia-carney-bdbd13b337ee12...
2•geox•56m ago•0 comments

Bending Emacs – Episode 6: Overlays [video]

https://www.youtube.com/watch?v=93wWCroTKnM
2•xenodium•58m ago•0 comments

Hydrogen fuel isn't always the green choice

https://www.nature.com/articles/d41586-025-03695-0
2•mpweiher•1h ago•0 comments

All OpenReview Data Leaks

https://twitter.com/iclr_conf/status/1994104147373903893
2•nsagent•1h ago•1 comments

Mapping a universe of open source software: the Nixpkgs dependency graph

https://www.tweag.io/blog/2019-02-06-mapping-open-source/
2•fanf2•1h ago•0 comments

Vibro-Braille for Deaf-Blind

1•Billiamdan•1h ago•0 comments

Acute Febrile Neutrophilic Dermatosis (Sweet Syndrome)

https://emedicine.medscape.com/article/1122152-overview
1•wjb3•1h ago•0 comments

Managed Code – New Site

https://www.managed-code.com/
2•managedcode•1h ago•0 comments