Re: update behavior

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Scott Ribe <scott_ribe(at)elevated-dev(dot)com>
Cc: Pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: update behavior
Date: 2025-06-19 17:35:37
Message-ID: 1461470.1750354537@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Scott Ribe <scott_ribe(at)elevated-dev(dot)com> writes:
> I believe that if I UPDATE a row with the same values that it already has, this still dirties pages, writes the row, generates a WAL entry. There is no shortcut in the processing that's "hey, there's not really a change here, we'll just leave storage alone".

> Is this correct?

It is. We do offer a trigger you can add to suppress zero-change
updates [1], but that's not the default behavior. We judged that
checking for that would add more cycles than it removes, for most
applications most of the time.

regards, tom lane

[1] https://www.postgresql.org/docs/current/functions-trigger.html

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Scott Ribe 2025-06-19 17:39:54 Re: update behavior
Previous Message Scott Ribe 2025-06-19 17:34:19 Re: update behavior