From 390312abbeece5df513e88748b10708f672bab04 Mon Sep 17 00:00:00 2001 From: Regina Obe Date: Mon, 3 Oct 2011 15:29:34 +0000 Subject: [PATCH] Guess Nicklas was right - should have looked at my explain. Revised example to use geometry constants. Seems to be a limitation in KNN that it needs constants. Same annoying behavior with my trigram KNN that only constant phrases work, not even constant phrases wrapped in alias work. git-svn-id: http://svn.osgeo.org/postgis/trunk@7935 b70326c6-7e19-0410-871a-916f4a2858ee --- doc/reference_operator.xml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/doc/reference_operator.xml b/doc/reference_operator.xml index 406adc73d..9af27bafe 100644 --- a/doc/reference_operator.xml +++ b/doc/reference_operator.xml @@ -1216,6 +1216,7 @@ Finally the hybrid: This operand will make use of any indexes that may be available on the geometries. It is different from other operators that use spatial indexes in that the spatial index is only used when the operator is in the ORDER BY clause. + Index appears to only kick in with contants Availability: 2.0.0 only available for PostgreSQL 9.1+ @@ -1223,14 +1224,17 @@ Finally the hybrid: Examples - --- this takes 125 ms on 25,000 gist indexed street table - d.geom As b_dist, ST_Distance(b.geom, d.geom) As act_dist +SELECT b.tlid, b.mtfcc, + b.geom <#> ST_GeomFromText('LINESTRING(746149 2948672,745954 2948576, + 745787 2948499,745740 2948468,745712 2948438, + 745690 2948384,745677 2948319)',2249) As b_dist, + ST_Distance(b.geom, ST_GeomFromText('LINESTRING(746149 2948672,745954 2948576, + 745787 2948499,745740 2948468,745712 2948438, + 745690 2948384,745677 2948319)',2249)) As act_dist FROM bos_roads As b - CROSS JOIN (SELECT geom FROM bos_roads WHERE tlid = 85732029) As d - ORDER BY b.geom <#> d.geom, b.tlid + ORDER BY b_dist, b.tlid LIMIT 100) As foo ORDER BY act_dist, tlid LIMIT 10;]]> -- 2.50.0