title: How do I calculate daily data from minute data in Q without killing KDB?
body: <p>I've written the following query:</p>
  <pre><code>select first(o), max(h), min(l), last(c), sum(v) by sym, t.date from disk
  </code></pre>
  <p>where 'disk' is a parted splayed disk table containing 160m rows.</p>
  <p>When I run this query, all RAM gets consumed and then KDB dies.</p>
  <p>What am I doing wrong?</p>
  <p><strong>Edit</strong>
  My schema is:</p>
  <pre><code>c  | t f a
  ---| -----
  t  | p    
  o  | f    
  h  | f    
  l  | f    
  c  | f    
  v  | i    
  sym| s   p
  </code></pre>