title: MySQL on custom function with MaxMind GeoLocation
body: <p>I have followed this tutorial with the latest data from MaxMind:</p>
  
  <p><a href="http://www.atomodo.com/code/how-to-really-import-the-maxmind-geoip-free-country-csv-file-into-mysql" rel="nofollow">http://www.atomodo.com/code/how-to-really-import-the-maxmind-geoip-free-country-csv-file-into-mysql</a></p>
  
  <p>I ran a test:</p>
  
  <pre><code>SELECT locid FROM blocks WHERE INET_ATON('174.36.207.186') BETWEEN startIPNum AND endIPNum
  </code></pre>
  
  <p>gave me 12120 in about 5 seconds</p>
  
  <pre><code>SELECT city FROM location WHERE locid = 12120;
  </code></pre>
  
  <p>gave me Washington.  Now, I added the custom function (IPTOLOCID) and it is indeed fast when I test like this:</p>
  
  <pre><code>SELECT IPTOLOCID("174.36.207.186")
  </code></pre>
  
  <p>it returns 12120 in like .0007 seconds.  But when I try to do this:</p>
  
  <pre><code>SELECT city FROM location WHERE locID = IPTOLOCID("174.36.207.186");
  </code></pre>
  
  <p>mysql just hangs... what did I do wrong?</p>