Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uSJQW-0063li-Im for pgsql-admin@arkaria.postgresql.org; Thu, 19 Jun 2025 17:51:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uSJQU-00DYqA-Bn for pgsql-admin@arkaria.postgresql.org; Thu, 19 Jun 2025 17:51:51 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uSJQU-00DYq2-0a for pgsql-admin@lists.postgresql.org; Thu, 19 Jun 2025 17:51:50 +0000 Received: from tunnel173844-pt.tunnel.tserv13.ash1.ipv6.he.net ([2001:470:7:2e6::2] helo=sloth.crazybean.net) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1uSJQP-002zMj-2u for pgsql-admin@lists.postgresql.org; Thu, 19 Jun 2025 17:51:47 +0000 Received: from smtpclient.apple ( [2001:470:e117:4:71ea:495b:3092:b203]) by sloth.crazybean.net (OpenSMTPD) with ESMTPSA id c4f953b1 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Thu, 19 Jun 2025 13:51:42 -0400 (EDT) From: Rui DeSousa Message-Id: <7B515BB7-0A75-4860-BEC0-D982C0EB9050@crazybean.net> Content-Type: multipart/alternative; boundary="Apple-Mail=_2B32C603-1D22-41A9-9133-9E5896667BCF" Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.10\)) Subject: Re: update behavior Date: Thu, 19 Jun 2025 13:51:39 -0400 In-Reply-To: <75F792AF-58DF-4559-A2E8-C89060D1E94E@elevated-dev.com> Cc: Pgsql-admin To: Scott Ribe References: <75F792AF-58DF-4559-A2E8-C89060D1E94E@elevated-dev.com> X-Mailer: Apple Mail (2.3696.120.41.1.10) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --Apple-Mail=_2B32C603-1D22-41A9-9133-9E5896667BCF Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jun 19, 2025, at 1:23 PM, Scott Ribe = wrote: >=20 > 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". >=20 > Is this correct? Correct, but it can be avoided.=20 No update occurs in this case:.=20 update foo set data =3D =E2=80=98hello world=E2=80=99 where id =3D 33 and data is distinct from =E2=80=98hello world=E2=80=99 ;= --Apple-Mail=_2B32C603-1D22-41A9-9133-9E5896667BCF Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On Jun 19, 2025, at 1:23 PM, Scott Ribe <scott_ribe@elevated-dev.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 =3D =E2=80=98hello world=E2=80=99
<= div class=3D"">where id =3D = 33
   and data is distinct from =E2=80=98hello = world=E2=80=99
;
= --Apple-Mail=_2B32C603-1D22-41A9-9133-9E5896667BCF--