Search Postgresql Archives

UPSERT and HOT-update

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux