title: PostgreSQL internals composite column cardinality
body: <p><strong>EDIT</strong></p>
  
  <p>This is not a question about space, but about uniqueness of index, which affects the query plan.</p>
  
  <p>In terms of cardinality, which index scenario is higher:</p>
  
  <p><strong>A</strong></p>
  
  <pre><code>Table:
  (
    Col1 smallint,
    Col2 smallint
  )
  </code></pre>
  
  <p>where</p>
  
  <pre><code>Range Col1 : 0 - 1000
  Range Col2 : 0 - 1000
  </code></pre>
  
  <p>and a composite index on <code>(Col1, Col2)</code>, always queried in sequence.</p>
  
  <p><strong>B</strong></p>
  
  <p>Table:</p>
  
  <pre><code>(
    Col1_2 int
  )
  </code></pre>
  
  <p>where</p>
  
  <pre><code>Range Col1_2 : 0 - 1000^2
  </code></pre>
  
  <p>and a single index on <code>(Col1_2)</code> with stores and queries combining the Col1 and Col2 components.</p>
  
  <p>What I am basically asking is, is it better (as in index usage) to combine multiple small numbers together (a hash), or does it make no difference?</p>