Hello,
I have a spatial table with about 1 million rows (extracted from the italian
ways shapefile).

I create a spatial index on that table. Then, I tried to perform the same
query; the first time I have not used the index, the second one I tried to
take full advantage from it. But, the execution time of the two queries is
quite the same. Everybody knows why? Here the two queries:

Without index:

SELECT name 
FROM 
        italia_900000 it, 
        ( 
                SELECT Transform(GeomFromText('POINT(7.662359 45.062477)', 
4326), 32632)
as the_geom_32632
        ) as p 
WHERE 
Intersects(it.the_geom_32632, p.the_geom_32632);

With index:

SELECT name 
FROM 
        italia_900000 it, 
        ( 
                SELECT Transform(GeomFromText('POINT(7.662359 45.062477)', 
4326), 32632)
as the_geom_32632
        ) as p 
WHERE 
Intersects(it.the_geom_32632, p.the_geom_32632)
AND it.pk_uid in 
( 
        SELECT pkid 
        FROM idx_italia_900000_the_geom_32632 
        WHERE 
                MBRMinX(p.the_geom_32632) - 100 < xmax and 
                MBRMaxX(p.the_geom_32632) + 100 > xmin and 
                MBRMinY(p.the_geom_32632) - 100 < ymax and 
                MBRMaxY(p.the_geom_32632) + 100 > ymin
);
-- 
View this message in context: 
http://old.nabble.com/Spatialite-RTree-index-tp31903692p31903692.html
Sent from the SQLite mailing list archive at Nabble.com.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to