Proper Storage of Millions of Phone Numbers in Postgres
The only pattern you can really follow for international phone numbers is to break them into three parts:
- International direct dialling prefix (maybe with associated table to lookup the country code: http://en.wikipedia.org/wiki/List_of_country_calling_codes)
- The phone number itself.
- Extension number(s)
Stored them as strings in order to preserve any desired formatting spaces or leading zeros, and validate that they follow an approved pattern.
Make a choice on whether to store national phone number "0" prefixes or not -- best to stick to the E.123 presentation of numbers where possible: http://en.wikipedia.org/wiki/E.123