Re: Performance impact of updating target columns with unchangedvalues ON CONFLICT - Mailing list pgsql-performance

From Justin Pryzby
Subject Re: Performance impact of updating target columns with unchangedvalues ON CONFLICT
Date
Msg-id 20181122224051.GK10913@telsasoft.com
Whole thread Raw
In response to Re: Performance impact of updating target columns with unchangedvalues ON CONFLICT  (Abi Noda <a@abinoda.com>)
Responses Re: Performance impact of updating target columns with unchangedvalues ON CONFLICT  (Abi Noda <a@abinoda.com>)
List pgsql-performance
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=HEAD
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


pgsql-performance by date:

Previous
From: Abi Noda
Date:
Subject: Re: Performance impact of updating target columns with unchangedvalues ON CONFLICT
Next
From: Jakub Glapa
Date:
Subject: Re: dsa_allocate() faliure