title: How does performance of EXTRACT(day) compare to BETWEEN?
body: <p>I'm querying a PostgreSQL table for rows in a range of days.  <code>BETWEEN</code> is a <a href="https://stackoverflow.com/a/15818137/407845">common recommendation</a>:</p>
  
  <pre><code>WHERE ts BETWEEN '2015-09-01' AND '2015-10-01'
  </code></pre>
  
  <p>I've also seen <code>EXTRACT</code> used:</p>
  
  <pre><code>WHERE EXTRACT(month from ts) = 9
  </code></pre>
  
  <p>Assuming <code>ts</code> is an indexed <code>timestamp</code> column, can <code>EXTRACT</code> match the speed of <code>BETWEEN</code>?  If so, I'm especially curious how it's implemented.  </p>