Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YtEMs-0005kL-KM for pgsql-committers@arkaria.postgresql.org; Fri, 15 May 2015 12:05:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YtEMr-0002vk-W7 for pgsql-committers@arkaria.postgresql.org; Fri, 15 May 2015 12:05:30 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YtEMq-0002vc-MZ for pgsql-committers@postgresql.org; Fri, 15 May 2015 12:05:29 +0000 Received: from mail-pa0-x232.google.com ([2607:f8b0:400e:c03::232]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1YtEMn-0007yr-PQ for pgsql-committers@postgresql.org; Fri, 15 May 2015 12:05:27 +0000 Received: by padbw4 with SMTP id bw4so11239013pad.0 for ; Fri, 15 May 2015 05:05:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=dbh5EX0KWHt3eF4zrKPRRmMA+QTDZiNlJM3sFSdquqc=; b=CdIAVSdnabplC86usuGfqRDD9bUz3Ppl8hqfzmRqpIjg/1MBz8inY/xapz1HKYuEtu Th3kfjbf7vT5cY+vDvrPIXNkiUJDtkCXvv/uX6rcP7SjMIahWNbzccTpTmHP/Hycg5Uw huoCIXIsnbXj+Co0Z4bkQpA+XqsAsC49egHFlfX/J4r9fhP1V+qvODcRdtu1AVR5pCRY 74LnDu3chjvandC+/9kGNQR/IzzGqI+lgl1eGokWo3k+9uATLr/RJPoOzi/r9Aa2hLRf nq4rvhZuzhWi0dY7h/b0wnaMhacD2Z0PNjJMC7OdLsutp5564xPGl5oJSNwyi0dMYf2G Ikig== MIME-Version: 1.0 X-Received: by 10.66.120.47 with SMTP id kz15mr17626857pab.20.1431691524310; Fri, 15 May 2015 05:05:24 -0700 (PDT) Received: by 10.70.83.72 with HTTP; Fri, 15 May 2015 05:05:24 -0700 (PDT) In-Reply-To: References: Date: Fri, 15 May 2015 21:05:24 +0900 Message-ID: Subject: Re: pgsql: Allow GiST distance function to return merely a lower-bound. From: Fujii Masao To: Heikki Linnakangas Cc: pgsql-committers Content-Type: text/plain; charset=UTF-8 X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-committers Precedence: bulk Sender: pgsql-committers-owner@postgresql.org On Fri, May 15, 2015 at 8:27 PM, Heikki Linnakangas wrote: > Allow GiST distance function to return merely a lower-bound. > > The distance function can now set *recheck = false, like index quals. The > executor will then re-check the ORDER BY expressions, and use a queue to > reorder the results on the fly. > > This makes it possible to do kNN-searches on polygons and circles, which > don't store the exact value in the index, but just a bounding box. > > Alexander Korotkov and me > > Branch > ------ > master > > Details > ------- > http://git.postgresql.org/pg/commitdiff/35fcb1b3d038a501f3f4c87c05630095abaaadab > > Modified Files > -------------- > doc/src/sgml/gist.sgml | 35 ++- > src/backend/access/gist/gistget.c | 30 ++- > src/backend/access/gist/gistproc.c | 37 +++ > src/backend/access/gist/gistscan.c | 5 + > src/backend/executor/nodeIndexscan.c | 379 +++++++++++++++++++++++++++- > src/backend/optimizer/plan/createplan.c | 73 ++++-- > src/backend/utils/adt/geo_ops.c | 27 ++ > src/include/access/genam.h | 3 + > src/include/access/relscan.h | 9 + > src/include/catalog/catversion.h | 2 +- > src/include/catalog/pg_amop.h | 2 + > src/include/catalog/pg_amproc.h | 2 + > src/include/catalog/pg_operator.h | 8 +- > src/include/catalog/pg_proc.h | 4 + > src/include/nodes/execnodes.h | 20 ++ > src/include/nodes/plannodes.h | 10 +- > src/include/utils/geo_decls.h | 3 + > src/test/regress/expected/create_index.out | 78 ++++++ > src/test/regress/sql/create_index.sql | 12 + > 19 files changed, 699 insertions(+), 40 deletions(-) Seems this patch causes the regression test of pg_trgm fail. The regression diff that I got is: *** /home/postgres/pgsql/head/contrib/pg_trgm/expected/pg_trgm.out 2013-07-23 16:46:22.212488785 +0900 --- /home/postgres/pgsql/head/contrib/pg_trgm/results/pg_trgm.out 2015-05-15 20:59:16.574926732 +0900 *************** *** 2332,2343 **** (3 rows) select t <-> 'q0987wertyu0988', t from test_trgm order by t <-> 'q0987wertyu0988' limit 2; ! ?column? | t ! ----------+------------- ! 0.411765 | qwertyu0988 ! 0.5 | qwertyu0987 ! (2 rows) ! drop index trgm_idx; create index trgm_idx on test_trgm using gin (t gin_trgm_ops); set enable_seqscan=off; --- 2332,2338 ---- (3 rows) select t <-> 'q0987wertyu0988', t from test_trgm order by t <-> 'q0987wertyu0988' limit 2; ! ERROR: index returned tuples in wrong order drop index trgm_idx; create index trgm_idx on test_trgm using gin (t gin_trgm_ops); set enable_seqscan=off; Regards, -- Fujii Masao -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers