title: Aggregating timeseries data on multiple axises?
body: <p>I have many millions of time-series points coming in each day with two important axes I need to search over. My data looks like the following:</p>
  
  <pre><code>X, Y, value, TIMESTAMP
  </code></pre>
  
  <p>Originally these were stored in MariaDB but the table size is growing too fast. Doing simple aggregate queries (like <code>SUM()</code>) are taking too long even on a medium-sized server with indexes. </p>
  
  <p>Here are some example queries:</p>
  
  <pre><code>SELECT COUNT(*) FROM tbl 
  WHERE X = 23 AND Y = 46 AND TIMESTAMP &gt; NOW() - INTERVAL 30 DAY
  
  SELECT X, Y, COUNT(*) FROM tbl
  WHERE TIMESTAMP &gt; NOW() - INTERVAL 30 DAY
  GROUP BY X, Y
  ORDER BY COUNT(*) DESC
  </code></pre>
  
  <p>I have two indexes:</p>
  
  <pre><code>X, Y, value
  X, Y, TIMESTAMP
  </code></pre>
  
  <p>I'm looking for recommendations on ways (or new databases) to store this data providing fast lookups for any combination of X and Y while filtering on TIMESTAMP or value.</p>