title: Is integer column index faster than string column index in case of index range scan?
body: <p>I have a database implementation task on <code>SQL Server</code>, where there is a table <code>A</code> containing a column - <code>yearMonth</code>. I don't need date operations such as calculating how many days or month between two dates etc. currently. The yearMonth can be defined as <code>Date</code>, <code>Int</code>, or <code>varchar(6)</code>. From the perspective of saving data space, 4-bytes <code>Int</code> is obviously the best choice as only 6-digit int is needed e.g. <code>201701</code>. Whereas <code>varchar(6)</code> occupies 6 bytes, <code>Date</code> occupies 2x4 bytes. (applied for most databases)</p>
  
  <p>But what about from the perspective of indexing, esp. in case of index range scan? </p>
  
  <ul>
  <li>If the column <code>yearMonth</code> is defined as <code>varchar(6)</code>, the index range scan can happen when using query <code>select .. from A where yearMonth IN (...)</code></li>
  <li>If the column <code>yearMonth</code> is defined as <code>Int</code> or <code>Date</code>, then index range scan can happen with operator like <code>&lt;=</code>, <code>&lt;=</code> etc.</li>
  </ul>
  
  <p>In the cases above, which type of column definition is more efficient when index range scan happens?</p>