title: Database Search on unique column: Long string or many int's or long's?
body: <p>I'm not sure what Database I will be going with (more likely SQL Server Express), so I don't know if that makes a difference (or <em>that much</em> of a difference) to matter.</p>
  
  <p>Basically I am looking to store my object in a database so I can search for a unique object.</p>
  
  <pre><code>public class FooBar
  {
      public GridItem[,]  Items { get; set; } //This is a 5x4 grid
  }
  
  public enum GridItem
  {
      a = 0,
      b,
      c
  }
  </code></pre>
  
  <p>At first I represented each GridItem as a 2 character binary (A = 00, B = 01, C = 10 -- I don't think this bogged my application that much building the string from the array) which gave me a 40 character string. I can search for this string in the database to match, but it got me thinking. Is it more efficient to leave each GridItem as an Int32 (or Int64) and search the database to see if ALL columns (GItem00, GItem01, ... GItem54) matches up to their appropriate row/column GridItem. I think the Int32 vs Int64 would probably have to do with the processor, so that's not as big of a deal. Basically, if speed is my #1 concern (not storage) which is better... spit out an 80 character string or store 20 different Int32's into the Database and search on those columns?</p>
  
  <p>Or, is there something even better, such as serializing the object into a binary and somehow being able to search for a matching blob? I'm not really a database guy, so I have no idea.</p>