I've got a simple question over here but it brings up quite a dilemma in my head right now. I'm saving IPs "the right way" but I'm having a hard time deciding whether I should turn the ip to an integer in PHP or in MySQL. It's probably going to be considered a semantic issue but what I'm looking for here primarily is speed. I personally think it's not MySQL's job to convert data, but I have a feeling MySQL is going to be faster than PHP in doing this. What will you advice me?
INSERT INTO table (ip) VALUES (INET_ATON('127.0.0.1'))
OR
$ip = ip2long('127.0.0.1');
$db->("INSERT INTO table (ip) VALUES ($ip)");