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

isnt working with integers generally faster than working with strings? that might be why some ppl store phone numbers and zip codes as int


that might be why some ppl store phone numbers and zip codes as int

Anyone who stores ZIP Codes as an int should have his dev license revoked. You've just corrupted the data you store for a hundred million people in the northeast.

I'm currently dealing with a situation where a system developed by an offshore team stored Social Security numbers as integers. They had no idea that an SSN can start with a zero, and didn't even do a basic web search to see what the possible range of values is before designing the database and application.


you can tell a 4 digit zip code has a leading zero that was removed though. you'll also get faster sql queries if you search for zip codes as int vs string


you can tell a 4 digit zip code has a leading zero that was removed though

Only if you're 100% sure your date is completely clean. Only very rarely is this the case, especially with ZIP Codes because the data almost always traces back to human input.

The initial query may be quicker, but then you have to compensate for the missing digits elsewhere, likely multiple times. You have to consider the expense to the whole system, not just to one query.


Not if the only thing you're doing with the number is converting it from/to a string...


And its very doubtful that is all Exchange is doing with it. Likely they have a large list of definitions to compare and track.




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

Search: