Note
This view was introduced in OceanBase Database V1.4.
Purpose
The information_schema.STATISTICS view displays the information about table indexes.
Columns
| Column | Type | Nullable? | Description |
|---|---|---|---|
| TABLE_CATALOG | varchar(512) | NO | The catalog. The value of this column is always def. |
| TABLE_SCHEMA | varchar(128) | NO | The name of the database. |
| TABLE_NAME | varchar(256) | NO | The name of the table. |
| NON_UNIQUE | bigint(20) | NO | Indicates whether the index is unique. |
| INDEX_SCHEMA | varchar(128) | NO | The name of the database. |
| INDEX_NAME | varchar(256) | NO | The name of the index. |
| SEQ_IN_INDEX | bigint(20) unsigned | NO | The ID of the index. |
| COLUMN_NAME | varchar(128) | NO | The name of the column. |
| COLLATION | varchar(1) | NO | The name of the collation. |
| CARDINALITY | bigint(0) | NO | The value of this column is NULL by default. |
| SUB_PART | bigint(20) | NO | The index prefix, which is the number of indexed characters if the column is only partly indexed. The value is NULL if the entire column is indexed. |
| PACKED | varchar(10) | NO | The value of this column is NULL by default. |
| NULLABLE | varchar(3) | NO | Indicates whether the column can be null. |
| INDEX_TYPE | varchar(16) | NO | The data structure type used by the index. |
| COMMENT | varchar(16) | NO | The comments. |
| INDEX_COMMENT | text | NO | The index comment. |
| IS_VISIBLE | varchar(3) | NO | Indicates whether the index is visible. |
| EXPRESSION | varbinary(262144) | NO | This column is used only for compatibility with MySQL. The value of this column is NULL.
NoteThis column was introduced in OceanBase Database V4.2.1. |
Sample query
Create an index table named
tbl1.obclient [test]> CREATE TABLE tbl1(id INT,name VARCHAR(18),date DATE,PRIMARY KEY (id),INDEX tbl1_idx1 (date));Query indexes on the
tbl1table.obclient [test]> SELECT * FROM information_schema.STATISTICS WHERE TABLE_NAME='tbl1';The query result is as follows:
*************************** 1. row *************************** TABLE_CATALOG: def TABLE_SCHEMA: test TABLE_NAME: tbl1 NON_UNIQUE: 1 INDEX_SCHEMA: test INDEX_NAME: tbl1_idx1 SEQ_IN_INDEX: 1 COLUMN_NAME: date COLLATION: A CARDINALITY: NULL SUB_PART: NULL PACKED: NULL NULLABLE: YES INDEX_TYPE: BTREE COMMENT: VALID INDEX_COMMENT: IS_VISIBLE: YES EXPRESSION: NULL *************************** 2. row *************************** TABLE_CATALOG: def TABLE_SCHEMA: test TABLE_NAME: tbl1 NON_UNIQUE: 0 INDEX_SCHEMA: test INDEX_NAME: PRIMARY SEQ_IN_INDEX: 1 COLUMN_NAME: id COLLATION: A CARDINALITY: NULL SUB_PART: NULL PACKED: NULL NULLABLE: INDEX_TYPE: BTREE COMMENT: VALID INDEX_COMMENT: IS_VISIBLE: YES EXPRESSION: NULL 2 rows in set