title: Multiple column indexes optimization for multiple column queries on SQL Server
body: <p>I have one table [table] with two columns that needs to be filtered: [column1] and [column2].</p>
  
  <p>In my program I execute a query like:</p>
  
  <pre><code>select * from [table] where [column1] = 'foo' and [column2] = 'bar';
  </code></pre>
  
  <p>Which is faster:</p>
  
  <ol>
  <li>Creating two indexes, one on each column. ([column1] and [column2])</li>
  <li>Creating one index containing both columns. ([column1]+[column2])</li>
  </ol>
  
  <p>This question have been bugging me for a while, I have no idea how query optimization works and how SQL Server uses the created indexes to speed up queries.</p>