[postgis-users] slowing down queries

Flavio Perri FPERRI at it.ibm.com
Thu Mar 8 02:33:44 PST 2007


Hi all,
      i'm a new postGIS user and I got problems with queries: they are very
slow!
I created an index using GIST (i read it from documentation) on the
geometry column of each table, but EXPLAIN tells me this:
"EXPLAIN select a.name from aree_milano a, milano_gps gps  where
Within(gps.point_geom,a.the_geom) GROUP BY a.name;
                                     QUERY PLAN

------------------------------------------------------------------------------------

 HashAggregate  (cost=1718868.95..1718870.84 rows=189 width=14)
   ->  Nested Loop  (cost=7.08..1658252.88 rows=24246430 width=14)
         Join Filter: within("outer".point_geom, "inner".the_geom)
         ->  Seq Scan on milano_gps gps  (cost=0.00..21611.64 rows=384864
width=21)
         ->  Materialize  (cost=7.08..8.97 rows=189 width=5187)
               ->  Seq Scan on aree_milano a  (cost=0.00..6.89 rows=189
width=5187)
(6 rows)"

The query wants to select all areas that contain all the points in the
other table and i used the postGIS function Within(). I also tried with
Contains(), but nothing changed. Why aren't the index used on the queries
(that was an example, but i wish to create a table from a select like
that)?
bye

Flavio




More information about the postgis-users mailing list