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

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

              http://www.postgresql.org/docs/faq

Reply via email to