title: In timescale db, while querying compressed chunks, segment by indexes are not getting used. How to make sure that indexes are used while querying?
body: <p>Below is my table schema:-</p>
  <pre><code>CREATE TABLE public.table1
  (
     machinecode character varying(100) COLLATE pg_catalog.&quot;default&quot; NOT NULL,
     groupname character varying(50) COLLATE pg_catalog.&quot;default&quot; NOT NULL,
     sensor character varying(100) COLLATE pg_catalog.&quot;default&quot; NOT NULL,
     &quot;time&quot; timestamp without time zone NOT NULL,
     value1 integer,
     value2 real,   
     PRIMARY KEY (machinecode, groupname,sensor, &quot;time&quot;)
  )
  
  CREATE INDEX ON table1 (machinecode,groupname,sensor, time DESC);
  
  SELECT create_hypertable('table1', 'time');
  SELECT set_chunk_time_interval('table1', INTERVAL '24 hours');
  
  ALTER TABLE table1 SET (
    timescaledb.compress,
    timescaledb.compress_segmentby = 'machinecode,groupname,sensor'
  );
  
  SELECT add_compression_policy('table1', INTERVAL '7 days');
  </code></pre>
  <p><a href="https://i.stack.imgur.com/yosl6.png" rel="nofollow noreferrer">Image 1</a></p>
  <p>But as can be seen from image 1, in explain no index scan is used on machinecode</p>
  <pre><code>select * from _timescaledb_catalog.hypertable
  where id =
  (SELECT compressed_hypertable_id FROM _timescaledb_catalog.hypertable
   WHERE table_name='table1');
  </code></pre>
  <p><a href="https://i.stack.imgur.com/Pv09g.png" rel="nofollow noreferrer">image 2</a>
  From image 2 it can be seen that compressed_hypertable_18 is formed and indexes on same is</p>
  <pre><code>CREATE INDEX _compressed_hypertable_18_machinecode__ts_meta_sequence_num_idx ON _timescaledb_internal._compressed_hypertable_18 USING btree (machinecode, _ts_meta_sequence_num)
  CREATE INDEX _compressed_hypertable_18_groupname__ts_meta_sequence_num_idx ON _timescaledb_internal._compressed_hypertable_18 USING btree (groupname, _ts_meta_sequence_num)
  CREATE INDEX _compressed_hypertable_18_sensor__ts_meta_sequence_num_idx ON _timescaledb_internal._compressed_hypertable_18 USING btree (sensor, _ts_meta_sequence_num)
  </code></pre>
  <p>But still in explain, query is not using index.</p>
  <p>How can i make sure that indexes are used while querying.</p>