title: Has anyone found an efficient way to store BSON ObjectId values in an SQL database?
body: <p>We are migrating some data from MySQL to Mongo and have been adding extra fields to some of our DB tables for the <a href="http://www.mongodb.org/display/DOCS/Object+IDs#ObjectIDs-TheBSONObjectIdDatatype" rel="nofollow">ObjectId</a> value of the migrated data objects. </p>
  
  <p>At the moment we are storing them as varchar(24) latin1_general_ci which works fine. </p>
  
  <p>However, for efficient storage/indexing we probably should convert back to the 12-byte binary value. Unfortunately, MySQL only seems to have <a href="http://dev.mysql.com/doc/refman/5.5/en/storage-requirements.html" rel="nofollow">native integer support up to 8 bytes</a>. Is there another option - binary perhaps? </p>
  
  <p><strong>Update</strong>: I am migrating from MySQL but only certain tables at the moment. So I first make duplicates of the objects in Mongo of a certain table. Then I go back to any other tables left in MySQL that have foreign key references to that old MySQL table ID and add a new reference field that will store the Mongo object's ID. I will then remove the original reference field the BIGINT.</p>
  
  <p><strong>Update 2:</strong> The reason I bring this up is that it may be 12 months more (or never) before we move this other data, so it will have a performance impact on the live web application until then.</p>