title: How should I attack a large GroupBy recordset in a JavaScript heavy stack?
body: <p>I'm currently using Node.js and Firebase on a project, and I love both.  My challenge is that I need to store millions of sales order rows that would look something like this:</p>
  
  <p><code>{ companyKey: 'xxx',
     orderKey : 'xxx',
     rowKey : 'xxx',
     itemKey : 'xxx',
     orderQty: '5',
     orderDate: '12/02/2015'
  }</code></p>
  
  <p>I'd like to query these records like the pseudocode below:</p>
  
  <p><code>Select sum(orderQty) from mydb where companyKey = 'xxx' and itemKey = 'xxx' groupby orderDate</code></p>
  
  <p>According to various reasons such as <a href="https://stackoverflow.com/questions/26331071/firebase-count-group-by">Firebase count group by</a>, groupby in general can be a tough nut to crack.  I've done it before using Oracle Materialized Views but would like to use some kind of service that just does all of that backend work for me so I can CRUD those sales orders without worrying about the aggregation maintenance.  I read in another stackoverflow post that Keen.io might be a good approach to this problem.</p>
  
  <p>How would the internet experts attack this problem if they were using a JavaScript heavy stack and they wanted an outside service to do aggregation by day for them?</p>
  
  <p>A couple of points I'm considering.  I'll update as they come up:  </p>
  
  <p>1) It seems I might have to take Keen.io off the list.  It's $125 for 1M rows.  I don't need all the power Keen.io provides, only aggregation by day.</p>
  
  <p>2) Going the Sequelize + PostGreSQL seems to be a decent compromise.  I can still use JavaScript, an ORM to alleviate the pain, and PostGreSQL hosting is usually cheap.</p>