Re: [COMMITTERS] pgsql: Allow GiST distance function to return merely a lower-bound.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [COMMITTERS] pgsql: Allow GiST distance function to return merely a lower-bound.
Date: 2015-05-23 19:35:21
Message-ID: 31465.1432409721@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi> writes:
> Allow GiST distance function to return merely a lower-bound.

I wondered how come this patch did not touch nodeIndexonlyscan.c.

After some investigation, it seems the only reason that this patch even
appears to work is that none of the built-in or contrib opclasses support
both lossy ordering operators and GIST fetch functions. Otherwise we
would do an index-only scan and the executor would simply ignore the
recheck flag.

I doubt we can ship this in this state; even if the core code doesn't
exercise the problematic combination, surely third-party opclasses
will want to?

I thought about hacking the planner to not select index-only scans,
but there's no way for it to know whether the opclass might return
recheck = true at runtime. I think the only real fix is to actually
propagate all the changes in nodeIndexscan.c into nodeIndexonlyscan.c.
Testing it would be problematic without a suitable opclass, though :-(

A short-term hack might be to throw a "not implemented" error in
nodeIndexonlyscan.c if it sees the distance-recheck flag set.

regards, tom lane

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2015-05-23 20:05:56 pgsql: Fix incorrect snprintf() limit.
Previous Message Tom Lane 2015-05-23 19:22:31 pgsql: Still more fixes for lossy-GiST-distance-functions patch.

Browse pgsql-hackers by date

  From Date Subject
Next Message Petr Jelinek 2015-05-23 19:52:28 Compiler warning about overflow in xlog.c
Previous Message Jeremy Harris 2015-05-23 18:05:54 Re: Asynchronous DRAM Self-Refresh