SP-GiST versus index-only scans

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: SP-GiST versus index-only scans
Date: 2011-12-14 18:00:44
Message-ID: 10839.1323885644@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

It would not take very much at all to make the SP-GiST stuff support
index-only scans, except for one thing: it's conceivable that an opclass
might choose to store only a lossy version of the original indexed
datum, in which case it'd not be able to reconstruct the datum on

I'm not sure how likely this is, because the design of SP-GiST forces
root-level leaf tuples to be stored with the original datum, but in
principle leaf tuples at lower levels might have lossy representations.
None of the current opclasses do that, but Oleg and Teodor evidently
foresee such cases, else they'd not have bothered with the recheck
support that's in there. (If the original datum is reconstructable then
the opclass can surely deliver a correct answer for every leaf tuple.)

So the problem is that we have to either disallow such opclass designs,
or support per-opclass rather than per-index-AM decisions about whether
index-only scans are possible.

We discussed that idea when the index-only-scans patch went in a few
months ago, but blew it off on the grounds that there didn't seem to be
any immediate need for it. Well, the need is here.

I think we should get rid of the pg_am.amcanreturn boolean column and
replace it with an AM support function. btree's would just return
constant true, but I envision SP-GiST's version interrogating the
opclass config function. (If we make the config function return this
info, we don't need to add anything to CREATE OPERATOR CLASS, which
seems like a good thing to me.)

regards, tom lane


Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-12-14 18:13:32 Re: [PATCH] PostgreSQL fails to build with 32bit MinGW-w64
Previous Message Robert Haas 2011-12-14 17:59:53 Re: [PATCH] PostgreSQL fails to build with 32bit MinGW-w64