Re: UNDO and in-place update

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: UNDO and in-place update
Date: 2017-01-05 16:01:47
Message-ID: CA+TgmoaLTrMkt+JNO6A-n2BDpyj32xia9jo6rfYG+WsWyouZSg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 5, 2017 at 6:51 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> UNDO has to be kept till heap page is marked as all visible. This is
> required to check the visibility of index. Now, I think the page can
> be marked as all visible when we removed corresponding dead entries in
> heap. I think the main point of discussion here is how vacuum will
> clean heap and index entries in this new system. Another idea could
> be that we allow undo entries to be removed (we can allow heap entry
> to be removed) based on if they are visible or not and then while
> traversing index we cross check in heap if the entry can be removed.
> Basically, check the TID and traverse undo contents if any to verify
> if the index entry can be removed. I think this sounds to be more
> complicated and less efficient than what I suggested earlier.

In my proposal, when a tuple gets updated or deleted in the heap, we
go find the corresponding index entries and delete-mark them. When an
index tuple is delete-marked, we have to cross-check it against the
heap, because the index tuple might not match the version of the heap
tuple that our snapshot can see. Therefore, it's OK to discard the
heap page's UNDO before cleaning the indexes, because the index tuples
are already delete-marked and rechecks will therefore do the right
thing.

In short, I agree with Dilip.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Vitaly Burovoy 2017-01-05 16:05:42 Re: [BUGS][PATCH] BUG #14486: Inserting and selecting interval have different constraints
Previous Message Robert Haas 2017-01-05 15:55:01 Re: UNDO and in-place update