Re: Clarification about HOT - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Clarification about HOT
Date
Msg-id 472B593E.4040408@enterprisedb.com
Whole thread Raw
In response to Re: Clarification about HOT  ("Gokulakannan Somasundaram" <gokul007@gmail.com>)
List pgsql-hackers
Gokulakannan Somasundaram wrote:
> Thanks Heikki.  I am still not getting what you said. In the case of HOT,
> you need to update the top pointer to point to some other tuple in some
> other page. That's one update. what's the other one?
> 
> say currently the top of heap chain points to (2,3) . Imagine we are making
> the HOT chain through the pages. there might be a situation it should start
> pointing to (4,5) after the tuple at (2,3) gets ready to be Vacuumed. We
> should just lock the page where the top of HOT chain resides and update it
> to point to (4,5). What else we should do atomically?

Imagine one more update, and we end up with a HOT chain like this:

(2,3) -> (4,5) -> (6,7)

Where (2,3) is a redirecting line pointer, (4,5) is a tuple that can be 
vacuumed, and (6,7) is the a live tuple. When vacuuming (4,5), the 
redirecting line pointer (2,3) needs to be updated at the same time.

The chain could be even longer, requiring either locking and modifying 
even more pages atomically, or doing the pruning in steps which leads to 
more WAL traffic among other things.

It could be done, we already have to deal with locking two pages 
simultaneously in heap_update, but it's pretty darn complex.

--   Heikki Linnakangas  EnterpriseDB   http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: Proposal: Select ... AS OF Savepoint
Next
From: Andrew Dunstan
Date:
Subject: Re: minimal update