on 4/19/05 9:32 AM, Keith Ivey at [EMAIL PROTECTED] wrote: > 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.
Anyone willing to put up a final tested and optimized sql query? -- ------------------------------------------------------------- Scott Haneda Tel: 415.898.2602 <http://www.newgeo.com> Novato, CA U.S.A. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]