title: Timescaledb memory consumption remains very low even when there is a lot of data
body: <p>I have a timescaledb setup where I periodically dump data (every 10 mins or so). It is deployed using docker-compose.</p>
  
  <p>The data consists of an entity_id and a measurement and a couple of other things like region etc.</p>
  
  <p>A typical query is <code>get per day minimum for last 30 days for an entity_id</code>.</p>
  
  <pre class="lang-sql prettyprint-override"><code>    SELECT
          time_bucket_gapfill('1 day', time, date_trunc('day', now() - interval '30 days'), date_trunc('day', now())) AS one_day,
          country,
          type_id,
          min(measurement)
      FROM hypertable
      WHERE
          entity_id='XYZ' AND
          country='US' AND
          time &gt; time_bucket('1 day', now() - interval '30 days') AND 
          time &lt; time_bucket('1 day', now())
      GROUP BY one_day, country, type_id
  </code></pre>
  
  <ul>
  <li>The server has 8GB of RAM.</li>
  <li>Chunk interval is set to 1 day.</li>
  <li><p>Each chunk's size is about 4.5GB</p>
  
  <pre><code>               chunk_table             | table_size | index_size | total_size
  ---------------------------------------|-------------------------|------------
  _timescaledb_internal._hyper_1_1_chunk |   696 MB   |  1675 MB   |   2370 MB
  _timescaledb_internal._hyper_1_2_chunk |  1318 MB   |  3223 MB   |   4540 MB
  _timescaledb_internal._hyper_1_3_chunk |  1318 MB   |  3222 MB   |   4539 MB
  _timescaledb_internal._hyper_1_4_chunk |  1318 MB   |  3223 MB   |   4540 MB
  </code></pre></li>
  </ul>
  
  <p>The db currently has about 24 chunks (24 days of data).</p>
  
  <p>I have been doing some benchmarking and load testing using <code>wrk</code> and found that a significant number of queries take several seconds to complete.
  The problem I am seeing is that the ram usage of timescaledb remains at about 50MB. And goes to about 100MB during the load test running the above query while the CPU usage and Disk IO shoot up significantly.</p>
  
  <p>My expectation was that about one chunk (the recent one) worth of data will be in RAM.
  Even if that assumption is wrong, the ram usage doesn't increase when the 30 day query is issued.</p>
  
  <p>I want to understand whether this is an expected behaviour or there is some problem with the setup.</p>
  
  <p>I tried setting memory reservation and memory limits to the docker container but it had no effect.</p>