Thread: pgsql: Fill tuple before HeapSatisfiesHOTAndKeyUpdate

pgsql: Fill tuple before HeapSatisfiesHOTAndKeyUpdate

From
Alvaro Herrera
Date:
Fill tuple before HeapSatisfiesHOTAndKeyUpdate

Failing to do this results in almost all updates to system catalogs
being non-HOT updates, because the OID column would differ (not having
been set for the new tuple), which is an indexed column.

While at it, make sure to set the tableoid early in both old and new
tuples as well.  This isn't of much consequence, since that column is
seldom (never?) indexed.

Report and patch from Andres Freund.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/9ee00ef4c7de991b9371f614ce9c03ff436ce383

Modified Files
--------------
src/backend/access/heap/heapam.c |   39 +++++++++++++++++++++++--------------
1 files changed, 24 insertions(+), 15 deletions(-)


Re: pgsql: Fill tuple before HeapSatisfiesHOTAndKeyUpdate

From
Bruce Momjian
Date:
On Fri, Feb  1, 2013 at 01:50:02PM +0000, Álvaro Herrera wrote:
> Fill tuple before HeapSatisfiesHOTAndKeyUpdate
>
> Failing to do this results in almost all updates to system catalogs
> being non-HOT updates, because the OID column would differ (not having
> been set for the new tuple), which is an indexed column.
>
> While at it, make sure to set the tableoid early in both old and new
> tuples as well.  This isn't of much consequence, since that column is
> seldom (never?) indexed.
>
> Report and patch from Andres Freund.

Was this a new bug in 9.3?

--
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + It's impossible for everything to be true. +


Re: pgsql: Fill tuple before HeapSatisfiesHOTAndKeyUpdate

From
Andres Freund
Date:
On 2013-02-01 12:25:04 -0500, Bruce Momjian wrote:
> On Fri, Feb  1, 2013 at 01:50:02PM +0000, Álvaro Herrera wrote:
> > Fill tuple before HeapSatisfiesHOTAndKeyUpdate
> >
> > Failing to do this results in almost all updates to system catalogs
> > being non-HOT updates, because the OID column would differ (not having
> > been set for the new tuple), which is an indexed column.
> >
> > While at it, make sure to set the tableoid early in both old and new
> > tuples as well.  This isn't of much consequence, since that column is
> > seldom (never?) indexed.
> >
> > Report and patch from Andres Freund.
>
> Was this a new bug in 9.3?

Yes, it got introduced in the fklocks patch. The 'tableoid' part is
present before that, but I can't see a usecase in indexing that column,
so I think not backpatching it is ok.

Greetings,

Andres Freund

--
 Andres Freund                       http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services