bruce wrote:
> Why three?  I explained using only two heap tuples:
> 
>       [item1]...[tuple1]
> 
> becomes on UPDATE:
>            ---------->
>       [item1]...[tuple1][tuple2]
>                       ----->
> 
> on another UPDATE, if tuple1 is no longer visible:
> 
>            ------------------>
>       [item1]...[tuple1][tuple2]
>                       <------
> 

Here is some pseudo-code that implements this:

  Definition:  Single-Index-Tuple Chain (CITC)

  Do old and new UPDATE rows have unchanged indexed columns?
        Is old row member of CITC?
                Point item id at first CITC visible tuple in chain
                Mark previous invisible CITC tuples as freespace

        Does page have free space?
                Add new tuple on the same page as old
                Mark old tuple as CITC
                Do not create index entries

VACUUM would have to be taught about CITC, and CREATE INDEX would have
to create entries in other indexes for cases where its new indexed
columns change inside a CITC.

Conceptually, CITC allows a single index entry to point to multiple
UPDATEd rows, allowing non-visible tuples to be recycled (and reused for
future UPDATEs) without affecting the index.

-- 
  Bruce Momjian   [EMAIL PROTECTED]
  EnterpriseDB    http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to