Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
184 views
in Technique[技术] by (71.8m points)

postgresql - Improve query performance by running ANALYZE?

  • 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

question from:https://stackoverflow.com/questions/66052724/improve-query-performance-by-running-analyze

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...