Did a bit of fiddling and I’ve got PostgreSQL doing zip code tricks. You can get the distance of one zip code with another. Or you can get a list of zip codes by radius.
All this works by a magic C function. It was originally writen for MySQL, but I was able to port it over to PostgreSQL with some effort (and much learning). If time allows, I’ll post the code and instructions in the webdev section. This cool is especially cool since it now includes location data which I didn’t have in the MySQL version.
Performance isn’t too bad for a query that has to hit 3 table to collect the data. The MySQL version goes supper fast, but it brings back a very limited amount of data (zip and distance).
Classic disclaimer: The zips are not 100% accurate, but close enough for most needs.