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?

Free eBook: Runtime Intelligence – The New AI Architecture (Manning)

https://blog.manning.com/runtime-intelligence
1•laksandkeys•23s ago•0 comments

Humanity Must Win: Defending Rights, Tackling Repression at the 2026 FIFA World

https://www.amnesty.org/en/documents/ior10/0837/2026/en/
1•hkhn•2m ago•0 comments

Uvwatauavawh – Meet the Pushy String (2013)

https://www.hexacorn.com/blog/2013/05/16/uvwatauavawh-meet-the-pushy-string/
1•dryarzeg•2m ago•0 comments

Show HN: Coasts – Containerized Hosts for Agents

https://github.com/coast-guard/coasts
1•jsunderland323•3m ago•1 comments

CodingFont: A game to help you pick a coding font

https://www.codingfont.com/
2•nvahalik•4m ago•0 comments

Tests Aren't for Catching Bugs

https://trippw.com/blog/tests-as-institutional-memory
1•devTripp•7m ago•0 comments

Show HN: NetLens – Instant CLI Assistant for Network Engineers

https://v0-netlens.vercel.app
1•nadavdebi•7m ago•0 comments

Show HN: AI Spotlight for Your Computer (natural language search for files)

1•DEEPAN_C•7m ago•0 comments

Making a Yooperlite Sphere [video]

https://www.youtube.com/watch?v=dKAKw2ugiyE
1•gus_massa•8m ago•0 comments

Solo dev creates Open Source Turboquant

https://github.com/TheTom/turboquant_plus
1•nico•9m ago•1 comments

Prompt Helix – Ask AI about any webpage without copy-pasting context

https://chromewebstore.google.com/detail/prompt-helix/ffjppocigpeamhokbpnknlplkbccjpin
1•helixlabs-dev•14m ago•0 comments

Nearly three-quarters of England's woods inaccessible to public, study finds

https://www.theguardian.com/environment/2026/mar/13/nearly-three-quarters-of-englands-woods-inacc...
1•robtherobber•14m ago•0 comments

Show HN: axil – A terminal user-interface for treesitter

https://github.com/terror/axil
2•crap•15m ago•0 comments

The Anatomy of an LLM Benchmark

https://cameronrwolfe.substack.com/p/llm-bench
1•Brajeshwar•16m ago•0 comments

The Four Laws of Black Hole Mechanics [video]

https://www.youtube.com/watch?v=54n0WofSNno
1•vinhnx•18m ago•0 comments

In Denmark, the Center Did Not Hold

https://jacobin.com/2026/03/denmark-social-democrats-centrism-elections/
2•PaulHoule•19m ago•0 comments

"Over 1.5 million GitHub PRs have had ads injected into them by Copilot"

https://www.neowin.net/news/microsoft-copilot-is-now-injecting-ads-into-pull-requests-on-github-g...
25•bundie•20m ago•6 comments

Anthropic Says Use More Agents to Fix Agent Code. Here's What's Missing

https://mergeshield.dev/blog/anthropic-multi-agent-harness-whats-missing
2•mergeshield•21m ago•0 comments

Show HN: Local video search with Qwen3-VL: no API, runs on Apple Silicon, GPUs

https://github.com/ssrajadh/sentrysearch/tree/master
1•sohamrj•21m ago•0 comments

The Race Down

https://renfoc.us/posts/1774107059-the_race_down
1•rtrigoso•22m ago•0 comments

Speed Is a Tactic, Not a Virtue

https://eleganthack.com/speed-is-a-tactic-not-a-virtue/
1•speckx•23m ago•0 comments

50 Years of Thinking Different

https://www.apple.com/50-years-of-thinking-different/
1•reconnecting•26m ago•0 comments

Zero Ambient Authority: The Principle That Should Govern Every AI Agent

https://grith.ai/blog/zero-ambient-authority-ai-agents
2•edf13•27m ago•0 comments

Show HN: Data Hogo – scan your repo for security issues

https://www.datahogo.com/en
1•efecto1920•27m ago•0 comments

Germany considers ramping up coal power to avert energy crisis

https://www.politico.eu/article/germany-considers-ramping-up-coal-power-to-avert-energy-crisis/
1•leonidasrup•28m ago•1 comments

Nested Simulation and Nested Intelligence: A Pessimistic Thought

https://lizeng614.github.io/posts/when-reality-feels-structured/?lang=en
1•LeoisNotAI•28m ago•0 comments

My side project was annihilated by Google

4•lilouartz•28m ago•0 comments

Railway (web app host) "accidentally enables CDN" causing massive data breaches

https://station.railway.com/questions/data-getting-cached-or-something-e82cb4cc
5•hihicoderhi•31m ago•1 comments

Show HN: Hacker News comments summary to telegram

https://github.com/juanpabloaj/hacker-news-summary
1•juanpabloaj•31m ago•0 comments

72% of the dollar's purchasing power was destroyed in just four episodes

https://eco3min.fr/en/us-inflation-is-not-linear/
3•latentframe•31m ago•0 comments