frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Ask HN: How can I load test PostgreSQL but avoid changing actual data?

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

Trump administration asks OpenAI to stagger release of new model

https://ca.finance.yahoo.com/news/us-presses-meta-agree-ai-213859668.html
1•wahnfrieden•41s ago•0 comments

A Survey on Lawvere's Fixed-Point Theorem (2025)

https://arxiv.org/abs/2503.13536
2•measurablefunc•3m ago•0 comments

I wrote a 750-page book on self-hosting in production

https://selfdeployment.io/#table_of_contents
2•kocyigityunus•5m ago•1 comments

Supercomplete.ai

https://www.supercomplete.ai/
2•ishener•6m ago•0 comments

Facebook/Astryx

https://github.com/facebook/astryx
2•geoffbp•8m ago•0 comments

Show HN: Appaca – AI Workspace for Operators

https://www.appaca.ai/
4•susros•8m ago•0 comments

Seeing Radio Waves at 30fps

https://www.crowdsupply.com/scale-rf/quadrf
2•mrtnmcc•11m ago•0 comments

MIT Open Courseware: Sailing Yacht Design

https://ocw.mit.edu/courses/2-996-sailing-yacht-design-13-734-fall-2003/download/
2•mlhpdx•18m ago•0 comments

Fundamental principles of the universe called into question by two physicists

https://www.scientificamerican.com/article/fundamental-principles-of-the-universe-called-into-que...
2•Jimmc414•20m ago•1 comments

Ludwig Spec Driven Development MCP

https://github.com/samdvr/ludwig
2•monoids•22m ago•0 comments

The Long-Term Thinker

https://zhenyi.gibber.blog/the-long-term-thinker
2•zhenyi•24m ago•0 comments

Show HN: Trophikos – a calm, ad-free recipe and cocktail library for iOS

https://apps.apple.com/us/app/trophikos/id6773508921
3•fetus8•26m ago•0 comments

Architectural Studies #02

https://www.fashionablylatetakes.com/p/architectural-studies-02
2•paulpauper•28m ago•0 comments

Bayer scores landmark victory as Supreme Court overturns Roundup verdict

https://www.fiercepharma.com/pharma/bayer-scores-major-win-scotus-overturns-roundup-verdict
2•olvy0•28m ago•0 comments

Echoes of the AI Winter

https://netzhansa.com/echoes-of-the-ai-winter/
2•signa11•30m ago•0 comments

Researcher got a death threat computing Rosetta Stone for Indus script [video]

https://www.youtube.com/watch?v=kwYxHPXIaao
2•teleforce•31m ago•0 comments

Fortune 500 bosses demanding staff RTO share 1 trait: Narcissism, research finds

https://fortune.com/2026/06/25/return-to-office-ceos-ego-research/
4•Markoff•32m ago•2 comments

AI agents are sensitive to nudges

https://www.pnas.org/doi/10.1073/pnas.2537030123
2•paulpauper•34m ago•1 comments

New Business Formation Is Surging–Again

https://marginalrevolution.com/marginalrevolution/2026/06/more-firms-more-dynamism.html
2•paulpauper•34m ago•0 comments

OpenAI will initially only release ChatGPT 5.6 to government-approved customers

https://www.engadget.com/2202129/openai-will-initially-only-release-chatgpt-5-6-to-government-app...
3•mattas•34m ago•0 comments

The Latent Capability Ceiling: When a Bigger Model Won't Fix Your Problem

https://tianpan.co/blog/2026-04-19-latent-capability-ceiling-llm-production
2•capplexham•35m ago•0 comments

Agent Engineering Roadmap – a beginner-friendly guide to building AI agents

https://github.com/audi0417/agent-engineering-roadmap
2•Audi0417•36m ago•0 comments

Leave Windows 11 Idle for 24 Hours and Watch What Happens [video][18 mins]

https://www.youtube.com/watch?v=Wtg_s1GQiMU
2•Bender•39m ago•1 comments

You can never replace your understanding

https://www.anthropic.com/research/claude-code-expertise
4•martianvoid•44m ago•0 comments

Faster KNN search in Manticore: 2-pass HNSW, batched distances, and AVX-512

https://medium.com/@s_nikolaev/faster-knn-search-in-manticore-2-pass-hnsw-batched-distances-and-a...
3•snikolaev•49m ago•0 comments

Has UC Denver Lost Control of Their Website?

https://www.ucdenver.edu/homepage
2•idontwantthis•53m ago•4 comments

The Art of War

https://en.wikipedia.org/wiki/The_Art_of_War
3•martianvoid•54m ago•0 comments

Agent Zero – A full Docker Linux system for your AI agent

https://github.com/agent0ai/agent-zero
2•modinfo•55m ago•0 comments

Hydrating plants during the heatwave with DIY irrigation

https://www.womanandhome.com/homes/homes-news/diy-irrigation-garden-hack-for-hot-weather/
2•smooke•56m ago•0 comments

Show HN: Shotlist – Make your AI agent prove its work with real screenshots

https://github.com/varmabudharaju/shotlist
3•softie123•57m ago•0 comments