Re: KNN-GiST with recheck

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: Emre Hasegeli <emre(at)hasegeli(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: KNN-GiST with recheck
Date: 2015-02-15 11:08:21
Message-ID: CAPpHfdstkF4RW_1cYje=EZyTx5VRgUK_+L3c2ucBASdD156tVg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 8, 2015 at 1:12 AM, Alexander Korotkov <aekorotkov(at)gmail(dot)com>
wrote:

> On Tue, Dec 16, 2014 at 4:37 PM, Heikki Linnakangas <
> hlinnakangas(at)vmware(dot)com> wrote:
>
>> Patch attached. It should be applied on top of my pairing heap patch at
>> http://www.postgresql.org/message-id/548FFA2C.7060000@vmware.com. Some
>> caveats:
>>
>> * The signature of the distance function is unchanged, it doesn't get a
>> recheck argument. It is just assumed that if the consistent function sets
>> the recheck flag, then the distance needs to be rechecked as well. We might
>> want to add the recheck argument, like you Alexander did in your patch, but
>> it's not important right now.
>>
>
> I didn't get how that expected to work if we have only order by qual
> without filter qual. In this case consistent function just isn't called at
> all.
>
> * I used the "distance" term in the executor, although the ORDER BY expr
>> machinery is more general than that. The value returned by the ORDER BY
>> expression doesn't have to be a distance, although that's the only thing
>> supported by GiST and the built-in opclasses.
>>
>> * I short-circuited the planner to assume that the ORDER BY expression
>> always returns a float. That's true today for knn-GiST, but is obviously a
>> bogus assumption in general.
>>
>> This needs some work to get into a committable state, but from a
>> modularity point of view, this is much better than having the indexam to
>> peek into the heap.
>
>
> Nice idea to put reordering into index scan node. Doesn't look like much
> of overengineering. I'm going to bring it to more commitable state.
>

Following changes has been made in attached patch:

* Get sort operators from pathkeys.
* Recheck argument of distance function has been reverted.

------
With best regards,
Alexander Korotkov.

Attachment Content-Type Size
knn-gist-recheck-5.patch application/octet-stream 42.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2015-02-15 11:55:28 Re: forward vs backward slashes in msvc build code
Previous Message Andrew Gierth 2015-02-15 09:54:21 Really bad blowups with hash outer join and nulls