Re: [PATCHES] GIN improvements

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Teodor Sigaev <teodor(at)sigaev(dot)ru>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCHES] GIN improvements
Date: 2008-07-24 17:20:42
Message-ID: 8177.1216920042@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

I wrote:
> Really? Then GiST needs to be fixed too. Otherwise you risk having
> queries return the same row twice. A bitmap indexscan plan would mask
> such an index bug ... but a plain indexscan won't.

BTW, there's another issue I forgot about yesterday, which is that
the planner assumes that all index AMs work correctly for backwards
scan. The place where the rubber meets the road here is that
if you DECLARE SCROLL CURSOR for a plan implemented as a plain
indexscan, then FETCH BACKWARDS is supposed to reliably generate
results consistent with previous FETCH FORWARDS, to wit the same
tuples in the reverse order.

We can assume that the query is using an MVCC snapshot, which means
that at the index level it's okay for the index to return newly-inserted
entries that weren't returned in the previous forward scan, or to not
return entries that were removed meanwhile by VACUUM. But re-ordering
live tuples is bad news.

The idea of copying the pending-tuples list into local scan state would
make this work as expected as far as the proposed patch goes, but I'm
wondering whether the behavior isn't completely broken anyway by
operations such as page splits. Do we need to change the planner to
assume that this only works nicely for btree?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Sabino Mullane 2008-07-24 17:54:31 Re: [ADMIN] shared_buffers and shmmax
Previous Message Tom Lane 2008-07-24 17:09:24 Re: Extending grant insert on tables to sequences

Browse pgsql-patches by date

  From Date Subject
Next Message Teodor Sigaev 2008-07-24 18:25:15 Re: [PATCHES] GIN improvements
Previous Message Tom Lane 2008-07-24 17:09:24 Re: Extending grant insert on tables to sequences