<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV id="yiv373365924"><P>Hi,</P><P></P><P>I will like to find out if this nearest neighbour query uses a postgis spatial index. The query is supposed to get the nearest atm's (POI) around a given location.</P><P>SELECT gid, descriptio, name, address, suburb, AsText(the_geom), <BR>           ST_Distance(ST_Transform(the_geom, 26331), ST_Transform(setsrid(makepoint(3.3315343, 6.5593127), 4326), 26331)) as dist FROM lagos_poi84<BR>             WHERE st_dwithin(ST_Transform(the_geom, 26331), ST_Transform(setsrid(makepoint(3.3315343, 6.5593127), 4326), 26331), 50000) <BR>            and suburb ~* '' and descriptio ~* 'atm' AND name ~* '' ORDER BY dist limit 50<BR><BR>I created an index on the transformed geometry as follows<BR></P><P>CREATE INDEX "lagos_poi84UTM26331_idx" ON "public"."lagos_poi84" USING GIST ( ST_Transform("the_geom",
 26331) );               <BR><BR><BR></P><P>In the postgis manual, it was said that the st_dwithin() function uses a spatial index if available. </P><P>Also, how can tell when a spatial query in postgis is using a spatial index ?</P><P></P><P>Cheers,</P><P>Roman.</P></DIV></td></tr></table><br>