16.06.2015, 11:49
I've been reading a lot of articles and documentation for optimization and I've discovered INET_ATON and INET_NTOA few days ago. Saving IPs as an integer (UNSIGNED) saves a lot of space but I was wondering which one is better
The second is what I came up with as I was using LIKE when I had them stored as VARCHAR as well, the first is from an article.
pawn Код:
SELECT COUNT(ip) FROM some_table WHERE ip BETWEEN INET_ATON('45.166.0.0') AND INET_ATON('45.166.255.255');
pawn Код:
SELECT COUNT(ip) FROM some_table WHERE INET_NTOA(ip) LIKE '45.166.%';