Re: Performance impact of updating target columns with unchanged values ON CONFLICT

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Abi Noda <a(at)abinoda(dot)com>
Cc: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: Performance impact of updating target columns with unchanged values ON CONFLICT
Date: 2018-11-22 22:40:51
Message-ID: 20181122224051.GK10913@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Jakub Glapa 2018-11-23 14:31:41 Re: dsa_allocate() faliure
Previous Message Abi Noda 2018-11-22 21:31:10 Re: Performance impact of updating target columns with unchanged values ON CONFLICT