statistics
The statistics view provides information about complete columns of table indexes. For details, see Table 1. This view is read-only. All users have the read permission on this view. Some information in the view is obtained based on statistics. Run ANALYZE before checking the information. (If data is updated in the database, you are advised to delay running ANALYZE.) If an index column is not a complete column in the table, the index column is not recorded in this view.
| 
       Name  | 
     
       Type  | 
     
       Description  | 
    
|---|---|---|
| 
       TABLE_CATALOG  | 
     
       varchar(512)  | 
     
       Name of the database. When lower_case_table_names is set to 0, the value of this column is case-sensitive. When lower_case_table_names is set to 1, the value of this column is case-insensitive.  | 
    
| 
       TABLE_SCHEMA  | 
     
       varchar(64)  | 
     
       Name of the schema to which the table containing the index belongs. When lower_case_table_names is set to 0, the value of this column is case-sensitive. When lower_case_table_names is set to 1, the value of this column is case-insensitive.  | 
    
| 
       TABLE_NAME  | 
     
       varchar(64)  | 
     
       Name of the table containing the index. When lower_case_table_names is set to 0, the value of this column is case-sensitive. When lower_case_table_names is set to 1, the value of this column is case-insensitive.  | 
    
| 
       NON_UNIQUE  | 
     
       bigint  | 
     
       Specifies whether the index is a non-unique index. If the index is unique, the value is 0; otherwise, the value is 1.  | 
    
| 
       INDEX_SCHEMA  | 
     
       varchar(64)  | 
     
       Name of the schema to which the index belongs. When lower_case_table_names is set to 0, the value of this column is case-sensitive. When lower_case_table_names is set to 1, the value of this column is case-insensitive.  | 
    
| 
       INDEX_NAME  | 
     
       varchar(64)  | 
     
       Name of the index. If the index is the primary key, the name is always PRIMARY. Otherwise, the name is the actual index name.  | 
    
| 
       SEQ_IN_INDEX  | 
     
       bigint  | 
     
       Sequence number of an index column in an index.  | 
    
| 
       COLUMN_NAME  | 
     
       varchar(64)  | 
     
       Name of an index column.  | 
    
| 
       COLLATION  | 
     
       varchar(1)  | 
     
       Sorting mode of a column in an index. 
  | 
    
| 
       CARDINALITY  | 
     
       bigint  | 
     
       Estimate of the number of unique values in the index.  | 
    
| 
       SUB_PART  | 
     
       bigint  | 
     
       This column is not supported in the current version, and the value is null.  | 
    
| 
       PACKED  | 
     
       varchar(10)  | 
     
       This column is not supported in the current version, and the value is null.  | 
    
| 
       NULLABLE  | 
     
       varchar(3)  | 
     
       Specifies whether the index column can contain null values. 
  | 
    
| 
       INDEX_TYPE  | 
     
       varchar(16)  | 
     
       Index method used, such as BTREE and UBTREE.  | 
    
| 
       COMMENT  | 
     
       varchar(16)  | 
     
       This column is not supported in the current version, and the value is null.  | 
    
| 
       INDEX_COMMENT  | 
     
       varchar(1024)  | 
     
       Comment of an index.  | 
    
Run ANALYZE to update the statistics and then check the view.
m_regression=# CREATE TABLE t1(a int) DISTRIBUTE BY hash(a); CREATE TABLE m_regression=# INSERT INTO t1 VALUES (1),(2); INSERT 0 2 m_regression=# CREATE INDEX t1_index_1 ON t1(a); CREATE INDEX m_regression=# ANALYZE; ANALYZE m_regression=# select table_catalog,table_name,index_name,index_type, cardinality from information_schema.statistics where table_name='t1'; table_catalog | table_name | index_name | index_type | cardinality ---------------+------------+------------+------------+------------- m_regression | t1 | t1_index_1 | UBTREE | 2 (1 row)
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot