Re: update behavior

From: Rui DeSousa <rui(at)crazybean(dot)net>
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:51:39
Message-ID: 7B515BB7-0A75-4860-BEC0-D982C0EB9050@crazybean.net
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

> On Jun 19, 2025, at 1:23 PM, Scott Ribe <scott_ribe(at)elevated-dev(dot)com> wrote:
>
> 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?

Correct, but it can be avoided.

No update occurs in this case:.

update foo
set data = ‘hello world’
where id = 33
and data is distinct from ‘hello world’
;

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Rui DeSousa 2025-06-19 17:57:20 Re: update behavior
Previous Message Scott Ribe 2025-06-19 17:48:30 Re: update behavior