UPSERT and HOT-update - Mailing list pgsql-general

From CHENG Yuk-Pong, Daniel
Subject UPSERT and HOT-update
Date
Msg-id CAOcLnUcsSw+G30kyc5UurDoZWh9yqMb+1aO6ixQXh0yEN8RTzg@mail.gmail.com
Whole thread Raw
Responses Re: UPSERT and HOT-update  (Stephen Frost <sfrost@snowman.net>)
List pgsql-general
Hi List,

I am doing a INSERT...ON CONFLICT...UPDATE.. on a table. The query is
mostly-UPDATE and does not change any columns most of the time, like
so:

  CREATE INDEX ON book(title);
  INSERT INTO book (isbn, title, author, lastupdate) VALUES ($1,$2,$3, now())
    ON CONFLICT (isbn) DO UPDATE set title=excluded.title,
author=excluded.author, lastupdate=excluded.lastupdate;

PostgreSQL seems to consider the title as changed and refused to do a
HOT-update. It works if I remove the `title=...` part.

Are there any tricks to make it smarter? The title don't change most
of the time after all.

Regards,
Daniel


pgsql-general by date:

Previous
From: David Steele
Date:
Subject: Re: [HACKERS] Request - repeat value of \pset title during \watch interations
Next
From: Ranier VF
Date:
Subject: Error: insufficient data in the message