title: MySQL performance of unique varchar field vs unique bigint
body: <p>I'm working on an application that will be implementing a hex value as a business key (in addition to an auto increment field as primary key) similar to the URL id seen in Gmail. I will be adding a unique constraint to the column and was originally thinking of storing the value as a bigint to get away from searching a varchar field but was wondering if that's necessary if the field is unique.</p>
  
  <p>Internal joins would be done using the auto increment field and the hex value would be used in the where clause for filtering. </p>
  
  <p>What sort of performance hit would there be in simply storing the value as a varchar(x), or perhaps a char(x) over the additional work in doing the conversion to and from hex to store the value as an integer in the database? Is it worth the additional complexity?</p>
  
  <p>I did a quick test on a small number of rows (50k) and had similar search result times. If there is a large performance issue would it be linear, or exponential? </p>
  
  <p>I'm using InnoDB as the engine.</p>