Re: Scan Keys

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Stark <gsstark(at)mit(dot)edu>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Scan Keys
Date: 2006-07-07 13:27:07
Message-ID: 87wtapmtp0.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:

> Greg Stark <gsstark(at)mit(dot)edu> writes:
> > But on that note, is it ok to use the bulkdelete index AM methods for
> > non-vacuum purposes
>
> Um, what would those be?

I'm sure with a little work I can imagine lots of reasons to want to pull out
all the index tuples from an index other than vacuum. I can't actually name
any right now, but I'm sure I'll think of some :)

> ambulkdelete and amvacuumcleanup are most certainly not designed to be
> used in any context other than VACUUM. You might be able to abuse them
> for some other purpose, but don't expect a warranty.

What I'm doing now is calling ambulkdelete with a callback that returns false
for every tuple and stuffs the item pointer into a data structure. It seems to
be working but I haven't tested it thoroughly yet.

I'm worried that ambulkdelete might have side effects on the index that aren't
obvious. Other than bumping the vacuum cycle id I don't see any in a quick
scan of the btree code. But I could have missed something or other access
methods could behave differently.

I would be happier with a generic "index sequential scan" interface. I realize
the cycle id trick restricts any such api to a single scanner at a time which
is fine for my purposes.

Actually is that really true? Wouldn't the cycle id setup work fine if a
subsequent scan started and the cycle id was bumped a second time? If you find
a page that was split with a cycle id greater than yours then you still know
it was split after you started. As long as the cycle id doesn't wrap while a
scan is proceeding it should be fine. Perhaps tagging the split pages with the
xid of the most recent scan instead of a separate cycle id concept?

--
greg

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2006-07-07 13:58:29 Re: xlog viewer prototype and new proposal
Previous Message David Fetter 2006-07-07 11:33:40 Re: request for feature: psql 'DSN' option