Improve query performance by running ANALYZE?

263 Views Asked by At
  • PostgreSQL version: 12.4
  • TimescaleDB version: 1.7.4

Hi,

I have a table in which data is distributed in multiple chunks based on time only i.e. created hypertables for one day. I am trying to improve the performance of SELECT query. To achieve that I had to run ANALYZE periodically over the whole table. Since there isn't any updation or deletion performed in the table, VACUUM seems inefficient in my case. Also, I cannot put multiple indexes either since it will decrease ingestion performance and it will take a large amount of disk space.

I am ingesting data into the table by order of time. The recent data will be stored in a successive hypertable.

Question:

Will I get any performance improvement if I run ANALYZE on only the newly created hypertable by assuming that I already ran ANALYZE on all previous hypertables?

ANALYZE _timescaledb_internal._hyper_103_45_chunk;

Or is it mandatory to run ANALYZE on the whole table to get best performance and why?

ANALYZE schema.table_name;

Thanks

0

There are 0 best solutions below