pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Justin Pryzby <pryzby@telsasoft.com>
To: Abi Noda <a@abinoda.com>
Cc: pgsql-performance@lists.postgresql.org
Subject: Re: Performance impact of updating target columns with unchanged values ON CONFLICT
Date: Thu, 22 Nov 2018 16:40:51 -0600
Message-ID: <20181122224051.GK10913@telsasoft.com> (raw)
In-Reply-To: <CAM37AMNtU++7TrayQvsN0vC4O31cMDybYuK8jT0D4__xkPGU=Q@mail.gmail.com>
References: <CAM37AMMs_FLcg-ZGm2JSK7PD_+f5unNa-wipGH4dLiprdhgaTw@mail.gmail.com>
	<CAM37AMNtU++7TrayQvsN0vC4O31cMDybYuK8jT0D4__xkPGU=Q@mail.gmail.com>

On Thu, Nov 22, 2018 at 01:31:10PM -0800, Abi Noda wrote:
> In other words, is Postgres smart enough to not actually write to disk any
> columns that haven’t changed value or update indexes based on those columns?

You're asking about what's referred to as Heap only tuples:
https://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=src/backend/access/heap/README.HOT;hb=H...
https://wiki.postgresql.org/wiki/Index-only_scans#Interaction_with_HOT

Note, if you're doing alot of updates, you should consider setting a lower the
table fillfactor, since HOT is only possible if the new tuple (row version) is
on the same page as the old tuple.

|With HOT, a new tuple placed on the same page and with all indexed columns the
|same as its parent row version does not get new index entries."

And check pg_stat_user_tables to verify that's working as intended.

Justin




view thread (5+ messages)  latest in thread

Message-ID: <20181122224051.GK10913@telsasoft.com>
Permalink:  ../20181122224051.GK10913@telsasoft.com/
Also on:    postgresql.org/message-id/20181122224051.GK10913@telsasoft.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: pryzby@telsasoft.com, a@abinoda.com, pgsql-performance@lists.postgresql.org
  Subject: Re: Performance impact of updating target columns with unchanged values ON CONFLICT
  In-Reply-To: <20181122224051.GK10913@telsasoft.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox