Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best Data Type and length to use for MSISDN storage

What would be the best Data Type to use for storing an MSISDN (phone number).

Need to be able to store any phone number in the world.

Does anyone know the maximum possible MSISDN length, including international dialling code?

For example South Africa phone numbers are +27xxxxxxxxx which results in 11 digits excluding the +

The + does not have to be stored.

Thanks in advance

like image 617
darryn.ten Avatar asked Jun 21 '12 07:06

darryn.ten


1 Answers

I'd use BIGINT. Please avoid using varchar at all costs. It's a very bad idea to use varchar or char.

Reasons. Varchar/char takes up more space, it's slower to do lookups and cross references and the index is larger too.

When designing tables try and keep them with set row lengths, things will run loads faster. If you have to have some text field it is often best to use char instead of varchar as the overhead cost of varchar is high.

Am working in telecoms for 12 years now designing/optimizing VoIP/SMS platforms. The number one killer when I come in to fix systems is varchars everywhere.

Just my 0.02 worth.

like image 116
jupiter909 Avatar answered Oct 05 '22 21:10

jupiter909