You are here: Re: Storing IP in MySQL as DOUBLE or INT ? « All PHP « IT news, forums, messages
Re: Storing IP in MySQL as DOUBLE or INT ?

Posted by Oli Filth on 02/04/06 05:23

cosmoKen said the following on 03/02/2006 17:06:
> Pete seems to have a particular data type of IP : "The IP is in
> something called a "inet_aton" format"
>
> I agree with you, a classic IP is a VARCHAR(15)

Complete waste of space - an IP is not a VARCHAR(15) - that's just a
human-readable format. VARCHAR(15) is 16 bytes of space (for something
of the form XXX.XXX.XXX.XXX), whereas in reality an IPv4 address is just
32 bits - 4 bytes, if you will. So a MySQL UNSIGNED INT type is
appropriate if you are concerned about efficient storage.

Conversion in and out of this format is trivial.


--
Oli

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация