A query can be slow because of many reasons. These include - having too many partitions, distribution of partition size, partition not merged, and the background tasks of the table.
In this article, we will show some commands that can be used for troubleshooting.
Display information about the partition distribution of a table.
SHOW PARTS_INFO FOR <dbName>.<tableName>;
SHOW PARTS_INFO FOR `sample_data`.`sample_data_cell_tower`;
|partition||The partition, which is distributed based on the partition key|
|first_partition||The value of the first partition column|
|total_parts_number||The total number of parts within the partition|
|total_parts_size||The total size of the partition (in bytes)|
|total_rows_count||The total number of rows of the partition|
Display the status of a running manipulation task that involves partitioned tables.
SHOW PARTS_STATUS FOR <dbName>.<tableName>;
|type||The type of manipulation task e.g. |
|elapsed||The elapsed time in seconds since the time the manipulation task is created|
|progress||The progress of manipulation task as a percentage|
|num_parts||The total number of source partitions that were processed by manipulation task|
|result_part_names||The names of the partitions that contain the result of the manipulation task|
|num_result_parts||The number of partitions that contain the result of the manipulation task|
|rows_read||The total number of rows that were read by the manipulation task|
|rows_written||The total number of rows that were written by the manipulation task|
|columns_written||The total number of columns that were written by the manipulation task|
|memory usage||The total amount of memory that was used by the manipulation task|
Display thread information responsible for the background tasks and the running status of the threads.
SHOW BACKGROUND_TASKS FOR <dbName>.<tableName>;
|type||The type of background task that is running e.g. |
|status||The current status of the background task e.g. |
|startup_time||The time at which the background task began|
|last_wakeup_interval||The interval between the last two times the task woke up to work|
|last_wakeup_time||The time at which the task last woke up to work|
|num_wakeup||The number of times the task has woken up to work|
Updated about 1 month ago