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?

Show HN: MCP for building secured apps on SQL databases

https://www.dronahq.com/mcp-server/
1•kinj28•1m ago•0 comments

Who coined the term "spin doctor"?

https://www.theguardian.com/notesandqueries/query/0,5753,-1124,00.html
2•teleforce•7m ago•0 comments

Cyberattacks target water systems in at least 12 states

https://www.axios.com/2026/08/04/water-cyberattacks-us-iran
2•toomuchtodo•8m ago•0 comments

Sendspin: Open standard for the complete music listening experience

https://github.com/Sendspin
1•teleforce•10m ago•0 comments

Are Native Americans in the final stages of cultural eradication in the USA?

https://medium.com/freedomofthought/are-native-americans-in-the-final-stages-of-cultural-eradicat...
1•raynchad•14m ago•0 comments

The Moral Compass of AI: Why Fairness Shapes Our Future

https://medium.com/freedomofthought/the-moral-compass-of-ai-why-fairness-shapes-our-future-d2aed5...
1•raynchad•24m ago•0 comments

SpaceX hit by surging AI costs as insiders prepare to sell their shares

https://www.nbcnews.com/business/business-news/spacex-earnings-surging-ai-costs-rcna590682
3•mapping365•24m ago•0 comments

Funding found for free meals in Seattle schools

https://www.seattletimes.com/education-lab/funding-found-for-free-meals-in-seattle-schools/
2•petethomas•27m ago•0 comments

Do you find paid contribution on AI Annotation (e.g. DataAnnotation), moral?

1•moorcheh•27m ago•1 comments

Massive Worms, Tiny Bodies: Why Horsehair Worms Might Be Good for Nature [video]

https://www.youtube.com/watch?v=1VSeb-ZNRYY
1•thunderbong•28m ago•0 comments

Solving the Shortest Vector Problem in $2^{0.6039n}$ Time via Mid-Point Hessian

https://arxiv.org/abs/2608.02478
1•sbulaev•30m ago•0 comments

Trump administration drafting ban on Chinese data center devices, sources say

https://www.reuters.com/world/trump-administration-drafting-ban-chinese-data-center-devices-sourc...
2•mikhael•31m ago•0 comments

I built an AI tool that turns your photo into a Greek mythology character

http://blurb.cam/
1•gaoheyang•31m ago•0 comments

Rochelle Hudson

https://the-wanderling.com/hudson.html
1•petethomas•33m ago•0 comments

Nucleus – A lightweight dashboard for Linux dev environments (PHP and systemd)

https://github.com/LebToki/Nucleus
1•LebToki•35m ago•0 comments

The White House Is Keeping Its AI Cybersecurity Framework Secret

https://www.wired.com/story/the-white-house-is-keeping-its-ai-cybersecurity-framework-secret/
4•reasonableklout•37m ago•0 comments

The Bitwarden subscription is now $20 a year

https://bitwarden.com/pricing/
2•mikalauskas•39m ago•0 comments

SF $192 fine for teaching tennis to his own children

https://twitter.com/Polymarket/status/2084790486590517503
4•bilsbie•40m ago•0 comments

Reliability Lessons from SQLite – Richard Hipp | SSW (2026) [video]

https://www.youtube.com/watch?v=V_qzqY1bb7I
1•mif•40m ago•1 comments

Learning BASIC Like It's 1983 (2018)

https://twobithistory.org/2018/09/02/learning-basic.html
1•downbad_•42m ago•0 comments

NPM Registry Protocol

https://github.com/npm/statusboard/issues/340
1•jcbhmr•44m ago•0 comments

DiCaprio and Bezos set USD$200M fund to recover endangered species

https://variety.com/2026/film/news/leonardo-dicaprio-jeff-bezos-project-endangered-species-123682...
3•teleforce•55m ago•0 comments

Show HN: AI Version of My Resume

2•ricky300300•59m ago•0 comments

NexBoard

https://nexboard.ca
2•KonDanikas•1h ago•1 comments

AI used new levels of 'autonomy and deception'

https://www.bbc.co.uk/news/articles/c1w1lvn7d9go
3•smarri•1h ago•0 comments

After Losses, Retail Investors Flock to 3x Leverage as 2x Product Are Restricted

https://www.asiae.co.kr/en/article/2026080416131786841
6•mapping365•1h ago•1 comments

Wine Planted in Sand

http://www.nlcwines.com/colares-1
1•marysminefnuf•1h ago•0 comments

Show HN: Hubmesh – Multi-hop RAG retrieval with zero LLM calls in the query path

https://github.com/DemigodDSK/hubmesh
1•dsk_7699•1h ago•0 comments

CrewAI in Python: Coordinating Teams of AI Agents

https://realpython.com/crewai-python/
2•inferhaven•1h ago•0 comments

Show HN: AI gateway open source integrated with cursor and open router

https://www.routerfuel.com/
2•U_Zargar•1h ago•0 comments