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?

Zorin OS: The Alternative to Windows and macOS

https://zorin.com/
1•thunderbong•1m ago•0 comments

Google Play Store will shame developers of sloppy, battery-wasting apps

https://www.neowin.net/news/google-play-store-will-shame-developers-of-sloppy-battery-wasting-apps/
1•bundie•1m ago•0 comments

Show HN: The Forensic Mirror – Weaponizing LLMs for Cognitive Auditing

https://github.com/type-null/forensic-mirror
1•llmmirror•3m ago•1 comments

Writing about Agentic Engineering Patterns

https://simonwillison.net/2026/Feb/23/agentic-engineering-patterns/
1•kristianp•4m ago•0 comments

Ask HN: How valuable is production scale experience vs. LeetCode in startups?

2•winsongr•9m ago•0 comments

OpenBSD on SGI: A Rollercoaster Story

http://miod.online.fr/software/openbsd/stories/sgiall.html
2•brynet•10m ago•0 comments

Source code for Minecraft Legacy Console Edition has leaked online

https://spilled.gg/minecraft-legacy-console-edition-source-code-builds/
1•ObviouslyFlamer•11m ago•0 comments

The Ada Lovelace Fable

https://twitter.com/gtredoux/status/2029300803144696309
1•MrBuddyCasino•12m ago•0 comments

The Modern Search Engine: The Complete Pipeline – How It Ranks Results

https://blog.ivan.digital/inside-the-modern-search-engine-the-complete-pipeline-how-it-ranks-resu...
1•ipotapov•13m ago•0 comments

Jira tasks can now write their own code (OpenAI Symphony)

https://github.com/openai/symphony/blob/main/README.md
1•bakigul•13m ago•0 comments

Chevron Warns of Irreversible Harm to Calif Economy in Letter to Gov. Newsom

https://californiaglobe.com/fl/chevron-warns-of-irreversible-harm-to-californias-economy-and-ener...
1•mudil•16m ago•0 comments

Social Capital Is a Design Choice: A Markov Framework for AI Trust

https://weightedthoughts.substack.com/p/social-capital-is-a-design-choice
1•ylliprifti•17m ago•1 comments

Cancer blood tests are everywhere. Do they work?

https://www.nature.com/articles/d41586-026-00661-2
3•sohkamyung•18m ago•0 comments

To update blobs or not to update blobs

https://codon.org.uk/~mjg59/blog/p/to-update-blobs-or-not-to-update-blobs/
2•pabs3•20m ago•0 comments

Douglas MacGregor Claims Netanyahu Draging US into War [video]

https://www.youtube.com/watch?v=g6QPz4XqVlQ
2•t23414321•20m ago•0 comments

72.000 pupils in Austria start 3-week smartphone-detox in controlled study

https://www.derstandard.de/consent/tcf/story/3000000310374/suchtexperte-zum-handy-detox-an-schule...
1•fzeindl•21m ago•0 comments

Why Claude Code is just a while loop (with 20 tools)

https://www.claudecodecamp.com/p/how-tool-use-actually-works-in-claude-code
1•aray07•21m ago•2 comments

Espflash – Go CLI/library for flashing ESP8266/ESP32 with no dependencies

https://github.com/tinygo-org/espflash
2•deadprogram•23m ago•0 comments

Where Visuals Meet Data – Come Annotate with Hitech BPO

https://www.hitechbpo.com/data-annotation-labeling.php
1•Hitechbpo•25m ago•1 comments

Relax NG is a schema language for XML

https://relaxng.org/
2•Frotag•26m ago•0 comments

A directory of indieweb directories

https://www.autodidacts.io/indie-blog-directory-directory/
1•Curiositry•26m ago•0 comments

Zed new terms required to be 18 years old

https://zed.dev/terms
3•keyle•27m ago•0 comments

Working on Things That Suck

https://mayberay.bearblog.dev/working-on-things-that-suck/
1•mugamuga•27m ago•1 comments

Asus Zenbook A14

https://www.asus.com/laptops/for-home/zenbook/asus-zenbook-a14-ux3407/
1•tosh•28m ago•0 comments

macOS Will Alert You to MacBook Neo's USB-C Port Limitation

https://www.macrumors.com/2026/03/04/macbook-neo-usb-c-port-limitation/
1•tosh•33m ago•0 comments

I Lost $150 in 20 Minutes Market-Making on Kalshi

https://rlafuente.com/posts/2025-3-5-i-lost-150-market-making-on-kalshi
2•andes314•40m ago•0 comments

Spektr – Ask plain English questions about any CSV, get charts

https://github.com/spektr-org/spektr
1•thepocketledger•42m ago•0 comments

Major TCPA Shift: Fifth Circuit Rules Oral Consent Is Valid

https://natlawreview.com/article/major-tcpa-shift-fifth-circuit-rules-oral-consent-valid
2•petethomas•42m ago•0 comments

OpenAI Symphony

https://github.com/openai/symphony
3•tosh•43m ago•0 comments

Show HN: Stop wasting time managing your hardware projects and focus on building [video]

https://www.youtube.com/watch?v=YPuKl5_qoG8
1•oleksg•44m ago•0 comments