Re: [HACKERS] gsoc knn spgist

2014-04-07 Thread Robert Haas
On Fri, Apr 4, 2014 at 11:56 AM, Костя Кузнецов  wrote:
> I want to implement knn for spgist. I dont have question with knn, but have
> questions with implementation of interface.
>
> i modify pg_am.h (set amcanorderbyop  to true in spgist index).Also i modify
> pg_amop.h(add
>
> DATA(insert (4015   600 600 15 o 517 4000 1970 ));
>
> )
>
> explain SELECT * FROM quad_point_tbl ORDER BY p <-> '-2,50'
>
>  Sort  (cost=1219.31..1246.82 rows=11003 width=16)
>Sort Key: ((p <-> '(-2,50)'::point))
>->  Index Only Scan using sp_quad_ind on quad_point_tbl
> (cost=0.15..480.70 r
> ows=11003 width=16)
> what am I doing wrong?

I don't know.  I think there are a lot of possibilities based on the
information provided.  A simple explanation would be that the planner
considered the plan you want and found the other one cheaper, but the
real cause could well be something else.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] gsoc knn spgist

2014-04-04 Thread Костя Кузнецов
Helllo. I want to implement knn for spgist. I dont have question with knn, but have questions with implementation of interface. i modify pg_am.h (set amcanorderbyop  to true in spgist index).Also i modify pg_amop.h(add  DATA(insert (    4015   600 600 15 o 517 4000 1970 )); ) explain SELECT * FROM quad_point_tbl ORDER BY p <-> '-2,50'  Sort  (cost=1219.31..1246.82 rows=11003 width=16)   Sort Key: ((p <-> '(-2,50)'::point))   ->  Index Only Scan using sp_quad_ind on quad_point_tbl  (cost=0.15..480.70 rows=11003 width=16)what am I doing wrong?In a gist index we have : regression=# explain SELECT * FROM point_tbl ORDER BY f1 <-> '-3,0'; QUERY PLAN  Index Scan using gpointind on point_tbl  (cost=0.13..8.27 rows=7 width=16)   Order By: (f1 <-> '(-3,0)'::point) Planning time: 0.166 ms(3 rows) Are there documents about modification access methods? Thanks.Constantine Kuznetsov

Re: [HACKERS] gsoc knn spgist

2014-03-25 Thread Alexander Korotkov
On Tue, Mar 25, 2014 at 8:16 PM, Костя Кузнецов  wrote:

> Hello.
>
> I submit a proposal. But Heikki Linnakangas write comments that i dont
> have a plan of implementation.
>
> My project is knn for spgist.
>
> Can I ask you a few questions?
>
> 1. I research a commit gist knn implementation. in gist implementation in
> role of queue is ised rtree(with distance comparator) , in spgist
> implementation this is List. Can i use rtree in spgist ? if i cant then i
> can use.
>

KNN-GiST uses RB-tree for queue. RB-tree is very different from R-tree. And
yes, it can be used in SP-GiST. However, alternative is heap (in-memory
structure, not table heap). I don't know why GiST doesn't use heap instead
of RB-tree.


With best regards,
Alexander Korotkov.


[HACKERS] gsoc knn spgist

2014-03-25 Thread Костя Кузнецов
Hello. I submit a proposal. But Heikki Linnakangas write comments that i dont have a plan of implementation. My project is knn for spgist. Can I ask you a few questions? 1. I research a commit gist knn implementation. in gist implementation in role of queue is ised rtree(with distance comparator) , in spgist implementation this is List. Can i use rtree  in spgist ? if i cant then i can use.  Thanks.   Constantine Kuznetsov