title: MySQL indexing phone numbers
body: <p>I'm working tons of phone numbers, and many are international.  </p>
  
  <p>I've changed my phone numbers table structure to have 5 columns:</p>
  
  <pre><code>`phonenumbers`.`phoneID`
  `phonenumbers`.`countrycode`
  `phonenumbers`.`areacode`
  `phonenumbers`.`phonenumber`
  `phonenumbers`.`ext`
  </code></pre>
  
  <p>At the moment the phoneID is the only column that's an INT, since it's the primary key.</p>
  
  <p>Should I change the other columns to integers?  I've heard indexes work best with numeric values, and I'm only storing numbers in each of the columns (no dashes, parenthesis, spaces, etc)</p>
  
  <p>I'm still learning how MySQL works with indexes, so I'm curious how others work with searching for numbers.  In this case, I'm sure I'll be searching for numbers that start with a certain known <code>areacode</code> and part of a known <code>phonenumber</code>, or an entire <code>phonenumber</code>.</p>
  
  <p>The part that gets me with indexing and table columns like phone numbers is that I don't always know how long a <code>phonenumber</code> will be. Since countries have different lengths for areacodes and phonenumbers.</p>
  
  <p>In summary, INT vs VARCHAR indexing with numbers.</p>