[postgis-users] Re: Spatial query performance

David Blasby dblasby at refractions.net
Thu Apr 8 10:17:17 PDT 2004


Jeremy Palmer wrote:
> SELECT  NOD1.id as nod_id1,
>         NOD2.id as nod_id2
> FROM    node NOD1,
>         node NOD2
> WHERE   NOD1.shape && expand(NOD2.shape,0.000002)
> AND     NOD1.id < NOD2.id;

I fixed this in the CVS version.

1. Somehow the memory leak fix I made got squashed.  Its "in there" now.
2. The other problem was that there were NULL geometries in the "node" 
table.  During the above query, postgresql would execute something like 
this:
  select * from node where shape &&  NULL::geometry;

    The GiST functions werent ready to handle this - I modified them so 
they would.

So, everything should work for you now.

NOTE: your query takes a long time to run because you're doing 
10,000,000 sub-queries.

dave



More information about the postgis-users mailing list