Hank wrote:
> Talk about over complicating things... here's the above query simplifed.
>
> I can not figure out why they were self joining the table three times:
Also, the index on zip_code, latitude, and longitude doesn't
make sense. Only the zip_code part of it was used, so it should
have been on zip_code alone. Latitude and longitude were only
used in calculations, so indexing them is useless.
If additional conditions were added to the WHERE to limit the
search to a square, then latitude and longitude indexes would be
useful, but they would have to be separate from each other and
from zip_code.
--
Keith Ivey <keith@stripped>
Smokefree DC
http://www.smokefreedc.org
Washington, DC