Re: Index vacuum improvements

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Index vacuum improvements
Date: 2006-03-30 16:51:03
Message-ID: Pine.OSF.4.61.0603301933001.228269@kosh.hut.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 29 Mar 2006, Tom Lane wrote:

> Heikki Linnakangas <hlinnaka(at)iki(dot)fi> writes:
>> 1. Instead of stopping on the first matching tuple, scan the whole index
>> page for all matching entries at once.
>
> That loses the ability to reflect tuple deadness back into LP_DELETE
> flags, no? Which is a problem already for bitmap indexscans, but I
> don't wish to give it up for regular indexscans too. With a solution
> for that it might be workable, but I don't see what we do about that.

At first glance, it doesn't look so hard. index_getmulti could mark
those tids that are dead, and btgetmulti would rescan the index page and
set LP_DELETE on all tuples that are still there.

We don't have to care about splits; if the index tuple is no longer where
it used to be, just ignore it. Right, no?

>> 2. Alternatively, the index scan could store the location of the last
>> known non-deletable tuple it has encountered, in addition to the tuple it
>> stops on. When a stopped scan continues, it checks if the tuple it was
>> stopped on is still on the same page. If it's not, instead of moving
>> right to find it, relocate the last known non-deletable tuple and
>> continue the scan from there. There can't be any visible tuples between
>> the tuple it stopped on and the last known non-deletable tuple, because
>> we would have encountered it before, and would know by now that it's
>> non-deletable.
>
> This one appears to be assuming MVCC visibility semantics, which means
> it will break system catalog operations, and probably foreign-key checks
> too.

True. Of course, we could special-case system catalogs. I don't know about
foreign keys, though. I've never looked at how it works.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-03-30 17:17:11 Re: can't get connection during pg_dump
Previous Message Jonah H. Harris 2006-03-30 16:46:19 pg_class catalog question...