title: date_trunc 5 minute interval in PostgreSQL
body: <blockquote>
  <p><strong>Possible Duplicate:</strong><br />
  <a href="https://stackoverflow.com/questions/7299342/what-is-the-fastest-way-to-truncate-timestamps-to-5-minutes-in-postgres">What is the fastest way to truncate timestamps to 5 minutes in Postgres?</a><br />
  <a href="https://stackoverflow.com/questions/12045600/postgresql-sql-group-by-time-interval-with-arbitrary-accuracy-down-to-milli-sec">Postgresql SQL GROUP BY time interval with arbitrary accuracy (down to milli seconds)</a></p>
  </blockquote>
  
  <p>I want to aggregate data at 5 minute intervals in PostgreSQL. If I use the <code>date_trunc()</code> function, I can aggregate data at an hourly, monthly, daily, weekly, etc. interval but not a specific interval like 5 minute or 5 days.</p>
  <pre><code>select date_trunc('hour', date1), count(*) from table1 group by 1;
  </code></pre>
  <p>How can we achieve this in PostgreSQL?</p>