> Let's say you've got, oh, 2000 records to search through.
> You're gonna end up doing a JOIN with:
> 2,000 X 65,000 == 130,000,000 tuples (records/results).
> 130 MILLION tuples is *way* too many for your basic $20/month site.
I'd say take some easy shortcuts first... like limit the join to the
zip code table by the target state (which of course is indexed), then
add the one, two or at most three neighboring states, if you're near a
border. Or just limit the join to all the neighboring states in one
shot). One, two, or three short running queries all in SQL is a
whole-lot better than adding un-normalized and redundant fields to the
source data table and populating it in a cron job and triggers. Talk
about taking the long way around.
And if anyone is looking for a datafile with worldwide cities (about
2.7 million records) and their lat/longs (not zips, though), here's a
place to download it for free:
For $50, you can get the addition of population of each city.