[postgis-devel] Why doesn't knn work on table1.geom <#>table2.geom

Nicklas Avén nicklas.aven at jordogskog.no
Sun Oct 2 03:58:36 PDT 2011


I have been playing some with the new knn-implementation.

If I write the query as Paul illustrates like



SELECT id, table1.geom<->ST_SetSrid('POINT(1,2)'::geometry, 3021) as
distance
FROM table1
ORDER BY distance
LIMIT 10;

Then the index kicks in and works as expected.

But if I take the second geometry, the point directlu from a table it
doesn't work like:

SELECT id, table1.geom<->table2.geom as distance
FROM table1, (SELECT geom FROM table1 where gid=1;) AS table2
ORDER BY distance
LIMIT 10;

/Nicklas




More information about the postgis-devel mailing list