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•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?

AI Has Taken over Open Source

https://socket.dev/blog/ai-has-taken-over-open-source
1•ChicknNuggt•1m ago•0 comments

How to Teach AI the "Taste"

1•Jasonwang123•4m ago•0 comments

Code-mapper: Free CLI tool to reduce LLM token usage on any codebases

https://github.com/damien220/code-mapper
1•Damien_220•5m ago•0 comments

The Mystical Meaning of 369 and Its Link to Nikola Tesla

https://www.mentalfloss.com/random-facts/meaning-number-369-nikola-tesla
1•anujbans•9m ago•0 comments

Important Update: Transitioning Bitnami Offerings on AWS

https://community.broadcom.com/tanzu/blogs/beltran-rueda-borrego/2026/05/20/important-update-tran...
1•zoptie•23m ago•1 comments

Ask HN: Have you seen Star Wars The Mandalorian and Grogu,nice CGI, no storyline

1•eagle10ne•26m ago•0 comments

China Launches Manned Spaceship on Mission Orbit Tiangong Space Station [video]

https://www.youtube.com/watch?v=Qk-IZODWUzM
1•Bender•29m ago•0 comments

D. Trump Jr. and Eric Trump Running Felony Fraud Scheme Prosecutable in New York

https://cmarmitage.substack.com/p/donald-trump-jr-and-eric-trump-are
10•JumpCrisscross•38m ago•1 comments

Geopolitical Technicals

1•almogodel•39m ago•0 comments

Global AI Diffusion: Q1 2026 Trends and Insights [pdf]

https://www.microsoft.com/en-us/research/wp-content/uploads/2026/05/Microsoft-AI-Diffusion-Report...
2•gmays•46m ago•0 comments

Ravens Don't Follow Wolves, They Predict Their Patterns

https://scitechdaily.com/ravens-dont-follow-wolves-they-predict-them/
1•Gaishan•1h ago•0 comments

NymphCast – Libre Multicast DNS Media Streaming to Any Device

https://github.com/MayaPosch/NymphCast
1•righthand•1h ago•1 comments

Freediving, Embodiment and Humanity – Joanna Rutkowska

https://tracesofhumanity.org/freediving-embodiment-and-humanity/
1•transpute•1h ago•0 comments

How Telescope Rancher Became the Hot New Job in Texas

https://www.youtube.com/watch?v=bN48vEqaQs8
1•colinbartlett•1h ago•0 comments

Ghost CMS SQL injection flaw exploited in large-scale ClickFix campaign

https://www.bleepingcomputer.com/news/security/ghost-cms-sql-injection-flaw-exploited-in-large-sc...
3•sbulaev•1h ago•0 comments

HN: Silau – AI detects employee burnout"

1•silau•1h ago•2 comments

Army runs secret wargames under central London

https://www.bbc.com/news/articles/c2e2vjl2ry8o
3•Vermin2000•1h ago•1 comments

The Morale of Tech Workers Is Plunging as Layoffs Mount

https://www.nytimes.com/2026/05/19/business/tech-layoffs-blind.html
6•bookofjoe•1h ago•4 comments

Cache – Meal plans from your local store's weekly sales

https://www.cache.fit/
2•blaughlin•1h ago•1 comments

A Unified Theory of Alignment in Layered Systems

https://a-unified-theory-of-alignment-in-layered-systems.tiiny.site/
1•CitizenOfEarth•1h ago•0 comments

The quiet grief of adult friendship

https://timesofindia.indiatimes.com/blogs/civil-irony/the-quiet-grief-of-adult-friendship/
2•crcastle•1h ago•1 comments

Show HN: SaveNeighbor – food delivery through your own personal network

https://www.saveneighbor.com
1•JJonesRatio•1h ago•2 comments

Canonical to shut Ubuntu Pastebin after 18 years of service

https://www.omgubuntu.co.uk/2026/05/canonical-ubuntu-pastebin-shutdown
2•colinprince•1h ago•1 comments

I built an online leather goods store focused on making gift buying less painful

https://www.vintageleather.com.au/
2•vickeycool•1h ago•2 comments

Tfdraw.dev – turn Terraform plan JSON into an editable architecture diagram

https://tfdraw.dev/demo
1•spoosh•1h ago•0 comments

Show HN: The first (free) podcast ad blocker

https://apps.apple.com/us/app/drea-podcast-ad-blocker/id6759070798
1•hamza_q_•1h ago•0 comments

Fatherhood Dramatically Rewires Your Brain

https://www.sciencealert.com/fatherhood-dramatically-rewires-your-brain-scans-reveal
4•Gaishan•1h ago•1 comments

How AI Talks People Out of Conspiracy Theories–and What We Can Learn from That

https://www.wsj.com/tech/ai/ai-debunks-conspiracy-theories-92eff2c5
3•MilnerRoute•2h ago•2 comments

Honopinion

https://honopinion.com
2•mroshani20•2h ago•0 comments

We Built Secure, Scalable Agent Sandbox Infrastructure

https://twitter.com/larsencc/status/2027225210412470668
2•gmays•2h ago•1 comments