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

Recordings from the 39th Chaos Communication Congress (39C3)

https://media.ccc.de/c/39c3
1•utopiah•4m ago•1 comments

Pronoia

https://en.wikipedia.org/wiki/Pronoia_(psychology)
1•momonga•7m ago•0 comments

Show HN: EventFlux – Lightweight stream processing engine in Rust

https://github.com/eventflux-io/engine
1•grainier•8m ago•0 comments

The Color Palettes of Vincente Minnelli

https://vinpauld.blogspot.com/2014/04/the-color-palettes-of-vincente-minnelli.html
2•handfuloflight•17m ago•0 comments

Qwen-Image-2512 AI Image Generator

https://qwen-image-2512.org/
1•bennyskd•20m ago•1 comments

Fantastic Reasoning Behaviors and Where to Find Them

https://arxiv.org/abs/2512.23988
2•frozenseven•20m ago•0 comments

The Cult of Costco

https://www.theatlantic.com/newsletters/2025/12/costco-is-an-american-achievement/685411/
2•sanreau•26m ago•0 comments

Agentic AI takes over predictions for 2026

https://www.forbes.com/sites/markminevich/2025/12/31/agentic-ai-takes-over-11-shocking-2026-predi...
1•cumo•26m ago•0 comments

Seeing in the New Year with Dinner in a Dinosaur

https://www.bbc.com/news/articles/cx2pgwj19plo
1•madaxe_again•32m ago•0 comments

Nationwide Tax Strike

https://twitter.com/i/status/2006130536184422555
4•barrister•35m ago•0 comments

A Solid Load of Bull

https://loup-vaillant.fr/articles/solid-bull
1•enz•37m ago•0 comments

Kowloon Walled City Documentary (English Subtitles) [video]

https://www.youtube.com/watch?v=S-rj8m7Ssow
2•thunderbong•37m ago•0 comments

100 blog posts, 6 years, 5 million views

https://austinhenley.com/blog/100.html
1•saikatsg•39m ago•0 comments

IQuest-Coder-V1

https://github.com/IQuestLab/IQuest-Coder-V1
1•miohtama•41m ago•0 comments

I accidentally indexed my SaaS using Google's site: search

https://www.google.com/search?q=site%3Avect.pro&oq=&gs_lcrp=EgZjaHJvbWUqCQgAECMYJxjqAjIJCAAQIxgnG...
1•WoWSaaS•43m ago•1 comments

The Math Book (2012)

https://sprott.physics.wisc.edu/pickover/math-book.html
2•vismit2000•47m ago•0 comments

Denmark becomes first country in world to end letter delivery

https://www.abc.net.au/news/2025-12-31/denmark-postal-service-ends-letter-delivery/106188988
8•Tomte•49m ago•3 comments

MHC: Manifold-Constrained Hyper-Connections

https://arxiv.org/abs/2512.24880
3•ipnon•51m ago•0 comments

Ask HN: How did you learn to code?

9•chistev•1h ago•37 comments

The State of OSS Funding data [pdf]

https://github.com/andrew/state-of-oss-funding/blob/032d4b6134b36ea3c0aa378ee946ad4f77a2ac79/slid...
1•8organicbits•1h ago•0 comments

Bulgaria and the Euro

https://en.wikipedia.org/wiki/Bulgaria_and_the_euro
2•tosh•1h ago•0 comments

Why many projects fail before execution begins

2•BenWebbProject•1h ago•0 comments

AI Disclosure Under U.S. Securities Law

https://zenodo.org/records/18113674
1•businessmate•1h ago•1 comments

Challenging algorithms and data structures every programmer should try (2022)

https://austinhenley.com/blog/challengingalgorithms.html
1•vismit2000•1h ago•0 comments

JShell Tutorial

https://cr.openjdk.org/~rfield/tutorial/JShellTutorial.html
1•wolfi1•1h ago•0 comments

Professional College Basketball Players??

https://www.brianvsutah.com/p/professional-college-basketball-players
1•bjshaw73•1h ago•0 comments

Atmospheric Computing

https://www.pfrazee.com/blog/atmospheric-computing
1•danabramov•1h ago•0 comments

Quantum-floor compression: Achieving GPT-4 capability at 1/120th the model size [pdf]

https://oroboroslab.github.io/quantum-floor-preview.pdf
2•cybertax•1h ago•2 comments

Claude Code in Action – Anthropic Official Claude Code Course

https://anthropic.skilljar.com/claude-code-in-action
3•Lwrless•1h ago•0 comments

Show HN: GitHub Action for AI/LLM Security Scanning in CI/CD

https://github.com/XSource-Sec/agent-audit-action
2•xsourcesec•1h ago•1 comments