Thomas Sailer wrote: > > The following query is very quick, it returns 20 rows within a small fraction > of a second: > select * from mapelements_rtree where NELAT>=79000000 and SWLAT<=80000000 and > NELON>=79000000 and SWLON<=80000000; > > The following query, however, takes a long time (almost half a minute): > select * from mapelements,mapelements_rtree where > mapelements_rtree.NELAT>=79000000 and mapelements_rtree.SWLAT<=80000000 and > mapelements_rtree.NELON>=79000000 and mapelements_rtree.SWLON<=80000000 and > mapelements.ID=mapelements_rtree.ID; > > This is basically how the rtree documentation suggests to perform > selects. Why is this query so slow, and what can I do to fix/workaround > this? >
Does this query run faster? select * from mapelements where ID in ( select ID from mapelements_rtree where mapelements_rtree.NELAT>=79000000 and mapelements_rtree.SWLAT<=80000000 and mapelements_rtree.NELON>=79000000 and mapelements_rtree.SWLON<=80000000 ); Dennis Cote _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users