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?

Her rape kit had a DNA match. In San Francisco, that's not enough

https://sfstandard.com/2026/07/20/sfpd-rape-kit-investigation/
1•computerliker•54s ago•0 comments

Agent Host Protocol

https://microsoft.github.io/agent-host-protocol/
1•gokhan•4m ago•0 comments

Data Science Weekly – Issue 661

https://datascienceweekly.substack.com/p/data-science-weekly-issue-661
1•sebg•4m ago•0 comments

Dinitz-Garg-Goemans conjecture is false

https://xcancel.com/DmitryRybin1/status/2079904005652893709
1•franzb•5m ago•0 comments

Why AI Challenges Us: Ego, Awareness, and the Illusion of Ascent

https://www.immaculateconstellation.info/why-ai-challenges-us-part-2-ego-pure-awareness-and-the-i...
1•manjuc•6m ago•0 comments

Doesn't OpenAI have every incentive to destroy HuggingFace?

3•jrm4•7m ago•0 comments

Computational Arbitrage in AI Model Markets via Routing, Finetuning

https://arxiv.org/abs/2603.22404
1•blackcat201•8m ago•0 comments

AMD calls CUDA a 'non-event'

https://www.pcgamer.com/hardware/amd-calls-cuda-a-non-event-says-companies-are-programming-at-lev...
2•neilfrndes•10m ago•0 comments

First experimental evidence of recursive self-improvement (RSI)

https://threadreaderapp.com/thread/2077079778793042425.html
2•gmays•12m ago•0 comments

What we know about the typical Polymarket user

https://www.pewresearch.org/short-reads/2026/07/22/what-we-know-about-the-typical-polymarket-user/
2•gnabgib•14m ago•0 comments

Show HN: AI-factory – a spec-driven pipeline that stops AI agents rotting code

https://github.com/highflame-ai/ai-factory
1•sharathr•16m ago•0 comments

Deleting Systems You Don't Understand

https://idiallo.com/blog/deleting-systems-you-dont-understand
1•firefoxd•17m ago•0 comments

AMD EPYC 9006 Venice Announced and Looks Poised to Be a Grand Slam

https://www.phoronix.com/review/amd-epyc-9006-venice
2•rbanffy•19m ago•1 comments

Looking for Feedback on Website

https://www.what2do.me/
1•gnrlnoob•20m ago•2 comments

How Tether Benefited as Trump Insiders Shaped First Crypto Law

https://www.bloomberg.com/features/2026-howard-lutnick-bo-hines-trump-tether-crypto-law/
3•petethomas•21m ago•0 comments

The Gospel of Gains: How Fitness Culture Went Mainstream

https://greyenlightenment.com/2026/06/30/the-all-the-gospel-of-gains-how-fitness-culture-went-mai...
1•paulpauper•22m ago•0 comments

Microsoft deleted Nokia's archive of unreleased ringtones in 2016 HMD sale

https://bsky.app/profile/techprodbangers.bsky.social/post/3mr4askb6tk2i
2•scblzn•22m ago•0 comments

Kalytera – tells you why your AI agent failed, not just that it did

https://kalytera.dev/
1•mathurpriya19•24m ago•0 comments

Locked in An Escape Room with Jacob Tsimerman

https://www.begiant.ca/stories/people/jacob-tsimerman-math
1•tibbar•24m ago•0 comments

DOE Fires the $5B Starter Gun for Its AI-Targeted Genesis Mission

https://www.nextplatform.com/hpc/2026/07/23/doe-fires-the-5-billion-starter-gun-for-its-ai-target...
1•rbanffy•25m ago•0 comments

The AI Productivity Paradox

https://www.svpg.com/the-ai-productivity-paradox/
2•andrii•27m ago•0 comments

Show HN: How far do I have to go to run into 100k people?

https://imjasonh.github.io/playground/population-rays/
2•ImJasonH•28m ago•0 comments

Sometimes Being First Means Seeing the End Before Anyone Else

https://www.quantamagazine.org/jacob-tsimerman-wins-2026-fields-medal-for-andre-oort-conjecture-p...
3•energy123•30m ago•0 comments

AI Agents Don't Respect Font Licenses

https://www.mixfont.com/blog/ai-agents-dont-respect-font-licenses
2•jenthoven•31m ago•0 comments

Show HN: Advanced Coffee Search Covering Over 17,000 coffees

https://beangenie.coffee/coffee
2•epicwynn•32m ago•0 comments

Show HN: Connecting my dumb garage and car's homelink buttons to Home Assistant

https://dsauerbrun.com/writing/dumb-garage
1•dsauerbrun•33m ago•0 comments

US announces double-digit tariffs on most of globe to replace expiring duties

https://finance.yahoo.com/economy/policy/article/trump-administration-announces-the-next-phase-of...
6•ck2•33m ago•3 comments

Tesla shares tumble 11% after discounts hit profits

https://www.ft.com/content/dc5e629b-562c-41e3-8b89-350af6960adc
2•doener•35m ago•0 comments

What Happened When Flock Came to My Town

https://www.404media.co/what-happened-when-flock-came-to-my-town/
1•Jimmc414•35m ago•0 comments

Lazarus Group Using Git Hooks to Hide Malware – Open-Source Malware Blog

https://opensourcemalware.com/blog/lazarus-group-uses-git-hooks-to-hide-malware
3•vinnyglennon•36m ago•0 comments