[wp-hackers] Storing IP's in the DB

Peter Westwood peter.westwood at ftwr.co.uk
Sun May 3 16:26:52 GMT 2009

On 30 Apr 2009, at 15:15, Dougal Campbell wrote:

> Ozh wrote:
>> Hey peeps
>> I've read that it's better & faster to store IP as integers instead  
>> of
>> strings, and then using INET_ATON / INET_NTOA functions to convert
>> (the argument being that MySQL is faster with numbers than with
>> strings)
>> Any reason why WP is not doing this?
> The only place that Core stores IP numbers is for comments, right?  
> Do we ever do any indexing by IP number? Even if so, it's not a very  
> common operation. It's probably mostly a case of "If it ain't broke,  
> don't fix it." There's just not much to gain by changing that,  
> except for the rare case of sites that spend a lot of time reviewing  
> zillions of spam comments and grouping/sorting them by IP.

And we also need to be forward compatible for IPv6 if we go down this  

I'm not sure I see of a end-user benefit in converting the addresses  
to integers

Peter Westwood
http://blog.ftwr.co.uk | http://westi.wordpress.com
C53C F8FC 8796 8508 88D6 C950 54F4 5DCD A834 01C5

More information about the wp-hackers mailing list