SHOW-ANALYZE

Name

SinceVersion 2.0

SHOW ANALYZE

Description

Use SHOW ANALYZE to view information about statistics collection jobs.

Syntax:

  1. SHOW [AUTO] ANALYZE < table_name | job_id >
  2. [ WHERE [ STATE = [ "PENDING" | "RUNNING" | "FINISHED" | "FAILED" ] ] ];
  • AUTO: Show historical information for automatic collection jobs only. Note that, by default, the status of only the last 20,000 completed automatic collection jobs is retained.
  • table_name: Table name, specify to view statistics job information for that table. It can be in the format db_name.table_name. When not specified, it returns information for all statistics jobs.
  • job_id: Job ID for statistics collection, obtained when executing ANALYZE. When not specified, this command returns information for all statistics jobs.

Output:

Column NameDescription
job_idJob ID
catalog_nameCatalog Name
db_nameDatabase Name
tbl_nameTable Name
col_nameColumn Name List
job_typeJob Type
analysis_typeAnalysis Type
messageJob Information
last_exec_time_in_msLast Execution Time
stateJob Status
schedule_typeScheduling Method

Here’s an example:

  1. mysql> show analyze 245073\G;
  2. *************************** 1. row ***************************
  3. job_id: 245073
  4. catalog_name: internal
  5. db_name: default_cluster:tpch
  6. tbl_name: lineitem
  7. col_name: [l_returnflag,l_receiptdate,l_tax,l_shipmode,l_suppkey,l_shipdate,l_commitdate,l_partkey,l_orderkey,l_quantity,l_linestatus,l_comment,l_extendedprice,l_linenumber,l_discount,l_shipinstruct]
  8. job_type: MANUAL
  9. analysis_type: FUNDAMENTALS
  10. message:
  11. last_exec_time_in_ms: 2023-11-07 11:00:52
  12. state: FINISHED
  13. progress: 16 Finished | 0 Failed | 0 In Progress | 16 Total
  14. schedule_type: ONCE

Each collection job can contain one or more tasks, with each task corresponding to the collection of a column. Users can use the following command to view the completion status of statistics collection for each column.

Syntax:

  1. SHOW ANALYZE TASK STATUS [job_id]

Here’s an example:

  1. mysql> show analyze task status 20038 ;
  2. +---------+----------+---------+----------------------+----------+
  3. | task_id | col_name | message | last_exec_time_in_ms | state |
  4. +---------+----------+---------+----------------------+----------+
  5. | 20039 | col4 | | 2023-06-01 17:22:15 | FINISHED |
  6. | 20040 | col2 | | 2023-06-01 17:22:15 | FINISHED |
  7. | 20041 | col3 | | 2023-06-01 17:22:15 | FINISHED |
  8. | 20042 | col1 | | 2023-06-01 17:22:15 | FINISHED |
  9. +---------+----------+---------+----------------------+----------+

Keywords

SHOW, ANALYZE