Re: gsoc knn spgist

Lists: pgsql-hackers
From: Костя Кузнецов <chapaev28(at)yandex(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Subject: gsoc knn spgist
Date: 2014-04-04 15:56:19
Message-ID: 360661396626979@web14m.yandex.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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

Attachment Content-Type Size
unknown_filename text/html 1.6 KB

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Костя Кузнецов <chapaev28(at)yandex(dot)ru>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: gsoc knn spgist
Date: 2014-04-07 14:50:32
Message-ID: CA+TgmoagR18XwsgDzj+JXPVQCYUUjvhqSu0RKZmDgJV2ReN1-A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

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