Re: knngist - 0.8 - Mailing list pgsql-hackers

From Teodor Sigaev
Subject Re: knngist - 0.8
Date
Msg-id 4CC16E50.90104@sigaev.ru
Whole thread Raw
In response to Re: knngist - 0.8  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: knngist - 0.8
List pgsql-hackers
> You can define the additional argument as providing all of the extra
> info about how the operator is being used, and, if it's being used for
> ordering, the details of the requested order.  What is your thinking
> on the matter?

Maby be useful, but it seems to me to be a bit overengineering for now. GiST 
will not support knn-search with different than ASC NULLS LAST order in foresee 
future, because it stores NULLs in unmaintainable manner for different ordering: 
NULLs could be everywhere in tree. So, implementation of ASC NULLS FIRST 
requires to read whole tree to find all NULLs value first. I can imagine, how to 
reorganize tree to store NULLs together for single-column index, but not for 
multi-column index. Orders DESC NULLS LAST/FIRST requires to introduce two more 
"infinite" values: one to notion of distance more than +INF and another, 
non-negative, but less than zero distance.

Again, it could be useful for modification of GiST known as ordered GiST. But 
ordered GiST uses completely different tree traversal algorithm for search and 
insert, and it hasn't any benefits comparing with B-Tree and GiST. It's looks 
like an autogiro which successfully combines disadvantages of airplanes and 
helicopters :)
-- 
Teodor Sigaev                                   E-mail: teodor@sigaev.ru
  WWW: http://www.sigaev.ru/
 


pgsql-hackers by date:

Previous
From: Teodor Sigaev
Date:
Subject: Re: gist DatumGetPointer returns pointer to corrupted data
Next
From: Leonardo Francalanci
Date:
Subject: Custom aggragation function that creates an array