Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Very nice. Small enough that I can read and understand every line of code, and it still does something useful.

One thing I don't get, is why you're not using the zip code as the primary key (or have any other sort of index on it). The id isn't even used as far as I can tell. Is it just blazingly fast enough as it is?



The database is mostly an abstraction layer for other people to get up and running with the API. On ZipLocate.us everything is cached in memory using Varnish, so API calls never even hit the database. When data is updated, updated zip codes are just refreshed in the cache.

Like disdev, I always use an auto-incrementing id, but you're right that the index should be on the zip code instead of the id.


Personally, I always use either an auto-incremented ID or a GUID. I don't like using a real value of the object as a key. Generally, I think it's good practice, but you're right... I'd index off of that.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: