On Fri, Apr 4, 2014 at 11:56 AM, Костя Кузнецов <chapaev28@yandex.ru> 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