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

Show HN: Mandarin Melon – A webapp for learning Chinese by reading social media

https://mandarin-melon.com
1•Wilduck•2m ago•0 comments

Show HN: E is for ENSHITTIFICATION – An illustrated children's book on big tech

https://www.evanshunt.com/enshittification/
1•ar_turnbull•4m ago•0 comments

Show HN: Life4.py – visualizes John Conway's Game of Life in a command terminal

https://github.com/jazzfan2/game_of_life
1•robtoscani•5m ago•0 comments

Construction project manager takes on software development

1•smalltorch•6m ago•0 comments

PyTheory Is Awesome

https://kennethreitz.org/essays/2026-03-25-pytheory_is_awesome
1•zdw•9m ago•0 comments

ARC-AGI-3

https://arcprize.org/blog/arc-agi-3-launch
2•beklein•9m ago•0 comments

Redis' creator on "agentic coding" the new Redis data structure

https://twitter.com/i/status/2036863924776136976
2•alainrk•10m ago•1 comments

Wharton Prompt-Library

https://gail.wharton.upenn.edu/prompt-library/
2•saikatsg•13m ago•0 comments

Somebody's watching me – Adventures in Cellular Location services

https://nickvsnetworking.com/somebodys-watching-me-adventures-in-cellular-locating/
1•speckx•14m ago•0 comments

Lix 2.95 "Kakigōri"

https://lix.systems/blog/2026-03-25-lix-2.95-release/
1•PuercoPop•15m ago•0 comments

A nature-based early wildfire detection system

https://pyri.io/
1•mooreds•15m ago•0 comments

She uncovered a terrifying lab hidden in California, with alleged ties to China

https://www.latimes.com/california/story/2026-03-25/she-uncovered-terrifying-lab-hidden-in-califo...
3•latchkey•16m ago•0 comments

ImpossibleBench: Measuring LLMs' Propensity of Exploiting Test Cases

https://arxiv.org/abs/2510.20270
1•BalinKing•16m ago•0 comments

Airport wait times are longest in TSA history, agency says

https://www.usatoday.com/story/news/nation/2026/03/25/tsa-line-airport-wait-times-highest-in-hist...
1•geox•16m ago•0 comments

FreeCAD Version 1.1 Released

https://blog.freecad.org/2026/03/25/freecad-version-1-1-released/
2•sho_hn•16m ago•1 comments

PostHog: What we wish we knew about building AI agents

https://twitter.com/posthog/status/2036847339466301918
1•nadis•18m ago•0 comments

Show HN: Yoink – Spotify to lossless with full metadata, self-hostable, ad-free

https://yoinkify.com
3•chasefrazier•19m ago•0 comments

People's Choice Award – Wildlife Photographer of the Year

https://www.nhm.ac.uk/wpy/peoples-choice
1•Tomte•20m ago•0 comments

RocketMapper Satellite Tracker

https://rocketmapper.com/satellites
1•jonbaer•21m ago•0 comments

Show HN: Got a tough conversation coming up? This AI app will help you prepare

https://toughconversations.app/
1•ddesposito•21m ago•0 comments

Claude Code gets 'safer' auto mode

https://www.theverge.com/ai-artificial-intelligence/900201/anthropic-claude-code-auto-mode
2•datadrivenangel•21m ago•0 comments

Apple randomly closes bug reports unless you "verify" the bug remains unfixed

https://lapcatsoftware.com/articles/2026/3/11.html
2•zdw•21m ago•0 comments

China still on track to supplant US as No 1 economy in 10 years

https://www.scmp.com/economy/china-economy/article/3347863/china-still-track-supplant-us-worlds-n...
1•mikhael•22m ago•0 comments

IXI's autofocusing lenses are almost ready to replace multifocal glasses

https://www.engadget.com/wearables/ixis-autofocusing-lenses-multifocal-glasses-ces-2026-212608427...
2•andsoitis•23m ago•0 comments

Automatically generate all 3D print files for organizing a drawer

https://geniecrate.com/
1•woktalk•24m ago•0 comments

Shader Development Studio

https://www.shader.se
1•memalign•26m ago•0 comments

Project N.O.M.A.D. Offline Survival Computer Bundles AI, Wikipedia, Khan Academy

https://github.com/Crosstalk-Solutions/project-nomad
2•tagami•26m ago•2 comments

Microsoft Rust Training Books

https://github.com/microsoft/RustTraining
1•serial_dev•27m ago•0 comments

High-performance denoising library for ray tracing

https://www.openimagedenoise.org/
1•teleforce•27m ago•0 comments

Updates to GitHub Copilot interaction data usage policy

https://github.blog/news-insights/company-news/updates-to-github-copilot-interaction-data-usage-p...
18•prefork•27m ago•4 comments