Re: vacuum, performance, and MVCC

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Cc: Jan Wieck <JanWieck(at)Yahoo(dot)com>, Hannu Krosing <hannu(at)skype(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Csaba Nagy <nagy(at)ecircle-ag(dot)com>, Mark Woodward <pgsql(at)mohawksoft(dot)com>, "Jonah H(dot) Harris" <jonah(dot)harris(at)gmail(dot)com>, Christopher Browne <cbbrowne(at)acm(dot)org>
Subject: Re: vacuum, performance, and MVCC
Date: 2006-06-26 01:29:31
Message-ID: 200606260129.k5Q1TVf03655@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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 bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

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

Browse pgsql-hackers by date

  From Date Subject
Next Message Jan Wieck 2006-06-26 02:08:50 Re: vacuum, performance, and MVCC
Previous Message Josh Berkus 2006-06-26 00:05:49 Re: Table clustering idea