更新时间:2025-09-12 GMT+08:00
分享

SHOW

功能描述

SHOW显示当前运行时参数的数值,同时还可以用于显示数据库对象的信息,如库信息、表信息、列信息或服务器的状态信息等。

注意事项

SHOW语法显示数据库对象信息时需要用户拥有相应权限,具体请参见参数说明

语法格式

SHOW 
  { 
    [VARIABLES LIKE] configuration_parameter | 
    TIME ZONE | 
    TRANSACTION ISOLATION LEVEL | 
    SESSION AUTHORIZATION |
    ALL
  };

SHOW {CHARACTER SET | CHARSET} [like_or_where];
SHOW COLLATION [like_or_where];
SHOW [FULL] COLUMNS FROM [tbl_name | db_name.tbl_name] [FROM db_name] [like_or_where];
SHOW CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name;
SHOW CREATE TABLE [tbl_name | db_name.tbl_name];
SHOW CREATE VIEW [view_name | db_name.view_name];
SHOW [DATABASES | SCHEMAS] [like_or_where];
SHOW [STORAGE] ENGINES;
SHOW {INDEX | INDEXES | KEYS} {FROM | IN} tbl_name [{FROM | IN} db_name] [WHERE expr];
SHOW [FULL] PROCESSLIST;
SHOW [GLOBAL | SESSION ] STATUS [like_or_where];
SHOW [GLOBAL | SESSION] VARIABLES [like_or_where];
SHOW [FULL] TABLES [{FROM | IN} db_name][LIKE 'pattern' | WHERE expr];
SHOW TABLE STATUS [{FROM | IN}db_name][LIKE 'pattern' | WHERE expr];

like_or_where: 
  {
    LIKE 'pattern' |
    WHERE expr
  };

参数说明

  • configuration_parameter

    运行时参数的名称。

    取值范围:可以使用SHOW ALL命令查看运行时参数。

  • TIME ZONE

    时区。

  • TRANSACTION ISOLATION LEVEL

    事务的隔离级别。

  • SESSION AUTHORIZATION

    当前会话的用户标识符。

  • {CHARACTER SET | CHARSET}

    显示所有可用的字符集。可以使用LIKE子句对列名进行模糊匹配,也可以使用WHERE子句指定更通用的选择条件。

    SHOW CHARACTER SET显示的列信息包括:

    • Charset:字符集名称。
    • Description:字符集的说明。
    • Default collation:字符集的默认排序规则。
    • Maxlen:存储一个字符所需的最大字节数。
  • COLLATION

    显示服务器支持的排序规则。可以使用LIKE子句对列名进行模糊匹配,也可以使用WHERE子句指定更通用的选择条件。

    SHOW COLLATION显示的列信息包括:

    • Collation:排序规则名称。
    • Charset:与排序规则相关联的字符集的名称。
    • Id:排序规则id。
    • Default:排序规则是否为其字符集的默认值。
    • Compiled:兼容字段,默认为Yes。
    • Sortlen:这与对以字符集表示的字符串进行排序所需的内存量有关。
  • [FULL] COLUMNS FROM [tbl_name | db_name.tbl_name] [FROM db_name] [like_or_where]

    显示指定表中的列信息,同时适用于视图。需要拥有指定表所在Schema的USAGE权限,同时还需要拥有指定表的任意表级权限或列级权限。仅显示拥有SELECT、INSERT、UPDATE、REFERENCES和COMMENT权限的列信息。可以使用LIKE子句对列名进行模糊匹配,也可以使用WHERE子句指定更通用的选择条件。

    FULL:可选,使输出额外包含列排序规则、注释及权限信息。可以使用db_name.tbl_name或FROM db_name语句的形式指定表所在的Schema,同时使用时,FROM db_name语句优先级高于db_name.tbl_name。

    SHOW COLUMNS显示的列信息包括:
    • Field:列名。
    • Type:列数据类型。
    • Collation:字符类型的排序规则,仅声明FULL关键字时才会显示。
    • Null:列值是否可以为NULL,可以为YES,否则为NO。
    • Key:列是否被索引,取值范围:
      • PRI:表示该列被主键索引。
      • UNI:表示该列是唯一索引中的第一列。
      • MUL:表示该列是非唯一索引中的第一列。
      • NULL:表示该列没有被索引,或者不是唯一索引或非唯一索引的第一列。
    • Default:列默认值。
    • Extra:列的附加信息,取值范围:
      • auto_increment:表示该列为自增列。
      • on update CURRENT_TIMESTAMP:表示该列具有ON UPDATE约束。
      • VIRTUAL GENERATED:表示该列为虚拟生成列。
      • STORED GENERATED:表示该列为存储生成列。
    • Privilege:用户对该列拥有的权限,只有使用FULL关键字时才会显示。
    • Comment:列注释,只有使用FULL关键字时才会显示。
  • CREATE {DATABASE | SCHEMA} [IF NOT EXISTS] db_name

    显示创建指定数据库的CREATE DATABASE语句。需要拥有指定Schema的USAGE权限。

    DATABASE和SCHEMA为同义词。如果SHOW语句包含IF NOT EXISTS语句,则输出的CREATE DATABASE语句中也包含IF NOT EXISTS。

  • CREATE TABLE [tbl_name | db_name.tbl_name]

    显示创建指定表的CREATE TABLE语句,同时适用于视图,作用于视图时与SHOW CREATE VIEW功能相同。需要拥有指定表所在Schema的USAGE权限,同时还需要拥有指定表的任意表级权限。

    可以使用db_name.tbl_name语句的形式指定表所在的Schema。设置GUC兼容性参数m_format_dev_version为's2'后,返回的结果集可能存在变化,具体信息请参见《兼容性说明》中的“MySQL兼容性说明 > MySQL兼容性M-Compatibility模式 > SQL > DML”章节的“SHOW CREATE TABLE”语法。

  • CREATE VIEW [view_name | db_name.view_name]

    显示创建指定视图的CREATE VIEW语句。需要拥有指定视图所在Schema的USAGE权限,同时还需要拥有指定视图的任意表级权限。可以使用db_name.view_name语句的形式指定视图所在的Schema。精度传递开关打开(m_format_behavior_compat_options开启enable_precision_decimal选项)时,不展示隐式类型转换信息。

  • [STORAGE] ENGINES

    当前数据库服务端支持的存储引擎。

  • [GLOBAL | SESSION ] STATUS

    显示数据库连接数以及运行时间,如不显式指定GLOBAL或SESSION,默认为当前会话。

    • GLOBAL:显示全局范围内的数据库连接数以及运行时间。
    • SESSION:显示当前会话的数据库连接数以及运行时间。
  • DATABASES | SCHEMAS

    当前数据库中所有Schema。查询结果使用字符集utf8mb4、字符序utf8mb4_bin。

  • INDEX | INDEXES | KEYS

    显示索引信息。GaussDB中临时表存储于独立的临时Schema中,在使用FROM或IN db_name条件来展示指定临时表索引信息时,须指明db_name为临时表所在的Schema才能展示临时表索引信息,否则会提示不存在该临时表。查询结果中Table、Index_type、Index_comment字段使用字符集utf8mb4、字符序utf8mb4_bin;字段Key_name、Column_name、Collation、Null、Comment字段使用字符集utf8mb4、字符序utf8mb4_general_ci。

  • [FULL] PROCESSLIST

    显示当前服务器内的线程信息。如果没有SYSADMIN权限,用户只能看到当前用户线程的信息。显示的内容同information_schema.processlist视图,具体返回结果请参见processlist。如果未指定FULL,返回结果中的Info列仅显示前100个字符。

  • ALL

    所有运行时参数。

  • [GLOBAL | SESSION] VARIABLES

    显示数据库系统变量的值,如不显式指定GLOBAL或SESSION,默认为当前会话。可以使用LIKE子句对列名进行模糊匹配,也可以使用WHERE子句指定更通用的选择条件。

    • GLOBAL:显示全局系统变量值。这些值用于为数据库的新连接初始化相应的会话变量。如果变量没有全局值,则不显示任何值。
    • SESSION:显示当前会话的系统变量值。如果变量没有会话值,则显示全局值。
  • [FULL] TABLES [{FROM | IN} db_name][LIKE 'pattern' | WHERE expr]

    查看指定数据库中的表或者视图,默认是用户查询时使用的数据库。不包含临时表。如果指定数据库,用户必须要有数据库的权限。查询结果按照升序排序。查询结果使用字符集utf8mb4、字符序utf8mb4_bin。

    • FULL:FULL可选,若指定FULL,显示信息中包含Table_type列。
    • {FROM | IN} db_name:指定查询数据库db_name中的表。
    • LIKE 'pattern': LIKE语法筛选符合pattern条件的表,当目标database是information_schema时,pattern被转为小写再进行匹配。
    • WHERE expr: WHERE语法筛选符合expr条件的表。
  • TABLE STATUS [{FROM | IN}db_name][LIKE 'pattern' | WHERE expr]

    M-compatibility模式数据库中SHOW TABLE STATUS语法功能为显示表和视图的信息,未指定Schema时默认为当前所在Schema,不包含临时表。查询结果使用的字符集和字符序在information_schema.tables的对应字段中体现。

    • {FROM | IN} db_name:指定查询数据库db_name中的表。
    • LIKE 'pattern': LIKE语法筛选符合pattern条件的表,当目标database是information_schema时,pattern被转为小写再进行匹配。
    • WHERE expr: WHERE语法筛选符合expr条件的表。
    表1 SHOW TABLE STATUS查询结果内容

    展示列

    字段含义

    映射字段

    Name

    表名称

    information_schema.tables.TABLE_NAME

    Engine

    表所用的引擎

    information_schema.tables.ENGINE

    Version

    所属版本

    information_schema.tables.VERSION

    Row_format

    行格式

    information_schema.tables.ROW_FORMAT

    Rows

    表中的行数

    information_schema.tables.TABLE_ROWS

    Avg_row_length

    平均长度

    information_schema.tables.AVG_ROW_LENGTH

    Data_length

    数据文件长度

    information_schema.tables.DATA_LENGTH

    Max_data_length

    数据文件最大长度

    information_schema.tables.MAX_DATA_LENGTH

    Index_length

    索引长度

    information_schema.tables.INDEX_LENGTH

    Data_free

    已分配但未使用的字节数

    information_schema.tables.DATA_FREE

    Auto_increment

    下一次自增值

    information_schema.tables.AUTO_INCREMENT

    Create_time

    创建表时间

    information_schema.tables.CREATE_TIME

    Update_time

    上一次更新数据的时间

    information_schema.tables.UPDATE_TIME

    Check_time

    表的最后一次check时间

    information_schema.tables.CHECK_TIME

    Collation

    表排序规则

    information_schema.tables.TABLE_COLLATION

    Checksum

    校验和

    information_schema.tables.CHECKSUM

    Create_options

    创建表的选项

    information_schema.tables.CREATE_OPTIONS

    Comment

    表注释

    information_schema.tables.TABLE_COMMENT

示例

  • SHOW语法示例
    --显示 timezone 参数值。
    m_db=# SHOW timezone;
    
    --显示所有参数。
    m_db=# SHOW ALL;
    
    --显示参数名中包含”var”的所有参数。
    m_db=# SHOW VARIABLES LIKE var;
  • SHOW CHARACTER SET语法示例
    -- 显示所有可用的字符集。
    m_db=# SHOW CHARACTER SET;
     charset | description | default collation  | maxlen 
    ---------+-------------+--------------------+--------
     UTF8    |             | utf8mb4_general_ci |       
    (1 row)
  • SHOW COLLATION语法示例
    --显示服务器支持的排序规则。
    m_db=# SHOW COLLATION;
         collation      | charset | id | default | compiled | sortlen 
    --------------------+---------+----+---------+----------+---------
     C                  | UTF8    |    |         | Yes      |        
     default            | UTF8    |    |         | Yes      |        
     POSIX              | UTF8    |    |         | Yes      |        
     utf8_bin           | UTF8    |    |         | Yes      |        
     utf8_general_ci    | UTF8    |    |         | Yes      |        
     utf8mb4_0900_ai_ci | UTF8    |    |         | Yes      |        
     utf8mb4_bin        | UTF8    |    |         | Yes      |        
     utf8mb4_general_ci | UTF8    |    | Yes     | Yes      |        
     utf8mb4_unicode_ci | UTF8    |    |         | Yes      |        
     utf8_unicode_ci    | UTF8    |    |         | Yes      |        
    (10 rows)
  • SHOW COLUMNS语法示例
    -- 创建表t01
    m_db=# CREATE TABLE t01 (
    	c1 int AUTO_INCREMENT COMMENT 'this is c1',
    	c2 int NOT NULL CHECK (c2 > 0),
    	c3 text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL COMMENT 'this is c3',
    	c4 int DEFAULT 5 COMMENT 'this is c4',
    	c5 datetime ON UPDATE current_timestamp COMMENT 'this is c5',
    	c6 int GENERATED ALWAYS AS (c2 + c4) STORED COMMENT 'this is c6',
    	c7 int UNIQUE COMMENT 'this is c7',
    	c8 int,
    	c9 text CHARSET utf8mb4 COLLATE utf8mb4_bin COMMENT 'this is c9',
    	c10 int COMMENT 'this is c10',
    	c11 int COMMENT 'this is c11',
    	c12 int COMMENT 'this is c12',
    	CONSTRAINT PRIMARY KEY (c1) USING btree COMMENT 'this is primary key',
    	CONSTRAINT FOREIGN KEY (c8) REFERENCES t01(c1),
    	CONSTRAINT CHECK (c10 > 0),
    	CONSTRAINT UNIQUE (c11) COMMENT 'this is unique constraint',
    	c13 text COMMENT 'this is c13',
    	c14 int COMMENT 'this is c14',
    	INDEX USING btree (c13(10)) COMMENT 'this is index',
    	INDEX (c13(10),c14) USING btree COMMENT 'this is index too'
    );
    
    -- 显示列信息
    m_db=# SHOW FULL COLUMNS FROM t01;
     Field |   Type   |     Collation      | Null | Key | Default |            Extra            |           Privileges            |   Comment   
    -------+----------+--------------------+------+-----+---------+-----------------------------+---------------------------------+-------------
     c1    | integer  |                    | NO   | PRI |         | auto_increment              | select,insert,update,references | this is c1
     c2    | integer  |                    | NO   |     |         |                             | select,insert,update,references | 
     c3    | text     | utf8mb4_bin        | YES  |     |         |                             | select,insert,update,references | this is c3
     c4    | integer  |                    | YES  |     | 5       |                             | select,insert,update,references | this is c4
     c5    | datetime |                    | YES  |     |         | on update CURRENT_TIMESTAMP | select,insert,update,references | this is c5
     c6    | integer  |                    | YES  |     |         | STORED GENERATED            | select,insert,update,references | this is c6
     c7    | integer  |                    | YES  | UNI |         |                             | select,insert,update,references | this is c7
     c8    | integer  |                    | YES  |     |         |                             | select,insert,update,references | 
     c9    | text     | utf8mb4_bin        | YES  |     |         |                             | select,insert,update,references | this is c9
     c10   | integer  |                    | YES  |     |         |                             | select,insert,update,references | this is c10
     c11   | integer  |                    | YES  | UNI |         |                             | select,insert,update,references | this is c11
     c12   | integer  |                    | YES  |     |         |                             | select,insert,update,references | this is c12
     c13   | text     | utf8mb4_general_ci | YES  | MUL |         |                             | select,insert,update,references | this is c13
     c14   | integer  |                    | YES  |     |         |                             | select,insert,update,references | this is c14
    (14 rows)
    
    m_db=# DROP TABLE t01;
  • SHOW CREATE DATABASE语法示例
    -- 创建db1
    m_db=# CREATE DATABASE IF NOT EXISTS db1 DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_bin;
    
    -- 显示db1创建语句
    m_db=# SHOW CREATE DATABASE db1;
     Database |                          Create Database                           
    ----------+--------------------------------------------------------------------
     db1      | CREATE DATABASE db1 DEFAULT CHARACTER SET UTF8 COLLATE utf8mb4_bin
    (1 row)
    
    -- 带IF NOT EXISTS
    m_db=# SHOW CREATE DATABASE IF NOT EXISTS db1;
     Database |                                 Create Database                                  
    ----------+----------------------------------------------------------------------------------
     db1      | CREATE DATABASE IF NOT EXISTS db1 DEFAULT CHARACTER SET UTF8 COLLATE utf8mb4_bin
    (1 row)
    
    m_db=# DROP DATABASE db1;
  • SHOW CREATE TABLE语法示例
    -- 创建表t01
    m_db=# CREATE GLOBAL TEMPORARY TABLE t01(
    	c1 int COMMENT 'this is c1',
    	c2 int PRIMARY KEY USING INDEX TABLESPACE pg_default,
    	c3 int,
    	c4 int,
    	CONSTRAINT UNIQUE (c3) COMMENT 'this is unique',
    	INDEX idx (c3) COMMENT 'this is index'
    ) COMMENT 'this is table'
    ON COMMIT PRESERVE ROWS;
    
    -- 设置兼容性参数m_format_dev_version为s2
    m_db=# SET m_format_dev_version='s2';
    -- 显示表t01的建表语句
    m_db=# SHOW CREATE TABLE t01;
     Table |                                                    Create Table                                                     
    -------+---------------------------------------------------------------------------------------------------------------------
     t01   | SET search_path = public;                                                                                          +
           | CREATE GLOBAL TEMPORARY TABLE t01 (                                                                                +
           |     c1 integer COMMENT 'this is c1',                                                                               +
           |     c2 integer NOT NULL,                                                                                           +
           |     c3 integer,                                                                                                    +
           |     c4 integer,                                                                                                    +
           |     CONSTRAINT t01_pkey PRIMARY KEY (c2) WITH (storage_type=USTORE) USING ubtree,                                  +
           |     CONSTRAINT t01_c3_key UNIQUE (c3) WITH (storage_type=USTORE) USING ubtree COMMENT 'this is unique'             +
           | )                                                                                                                  +
           | CHARACTER SET = "UTF8" COLLATE = "utf8mb4_general_ci" COMMENT 'this is table'                                      +
           | WITH (orientation=row, compression=no, storage_type=USTORE, segment=off)                                           +
           | ON COMMIT PRESERVE ROWS;                                                                                           +
           | CREATE INDEX idx USING ubtree ON t01 (c3) WITH (storage_type=USTORE) TABLESPACE pg_default COMMENT 'this is index';
    (1 row)
    
    -- 设置兼容性参数m_format_dev_version为空
    m_db=# SET m_format_dev_version='';
    -- 显示表t01的建表语句
    m_db=# SHOW CREATE TABLE t01;
     Table |                                                    Create Table                                                     
    -------+---------------------------------------------------------------------------------------------------------------------
     t01   | SET search_path = public;                                                                                          +
           | CREATE GLOBAL TEMPORARY TABLE t01 (                                                                                +
           |     c1 integer,                                                                                                    +
           |     c2 integer NOT NULL,                                                                                           +
           |     c3 integer,                                                                                                    +
           |     c4 integer                                                                                                     +
           | )                                                                                                                  +
           | CHARACTER SET = "UTF8" COLLATE = "utf8mb4_general_ci"                                                              +
           | WITH (orientation=row, compression=no, storage_type=USTORE, on_commit_delete_rows=false, segment=off);             +
           | COMMENT ON TABLE t01 IS 'this is table';                                                                           +
           | COMMENT ON COLUMN t01.c1 IS 'this is c1';                                                                          +
           | CREATE INDEX idx USING ubtree ON t01 (c3) WITH (storage_type=USTORE) TABLESPACE pg_default COMMENT 'this is index';+
           | COMMENT ON INDEX idx IS 'this is index';                                                                           +
           | ALTER TABLE t01 ADD CONSTRAINT t01_c3_key UNIQUE USING ubtree (c3) WITH (storage_type=USTORE);                     +
           | COMMENT ON INDEX t01_c3_key IS 'this is unique';                                                                   +
           | ALTER TABLE t01 ADD CONSTRAINT t01_pkey PRIMARY KEY USING ubtree  (c2) WITH (storage_type=USTORE);
    (1 row)
    
    m_db=# DROP TABLE t01;
  • SHOW CREATE VIEW语法示例
    -- 创建视图
    m_db=# CREATE TABLE t01 (c1 int, c2 int, c3 int);
    m_db=# CREATE VIEW v01 AS SELECT c1 AS col1, c3 AS col2 FROM t01;
    
    -- 显示视图v01的创建语句
    m_db=# SHOW CREATE VIEW v01;
     View |                   Create View                   | character_set_client | collation_connection 
    ------+-------------------------------------------------+----------------------+----------------------
     v01  | CREATE VIEW v01 AS                             +|                      | 
          | SELECT t01.c1 AS col1, t01.c3 AS col2 FROM t01; |                      | 
    (1 row)
    
    m_db=# DROP VIEW v01;
    m_db=# DROP TABLE t01;
  • SHOW PROCESSLIST语法示例
    -- 用test用户连接M兼容库db_m,显示线程信息
    m_db=# SHOW FULL PROCESSLIST;
           Id        | User | Host |  db  | Command | Time | State |          Info          
    -----------------+------+------+------+---------+------+-------+------------------------
     139880022669056 | test |      | m_db |         |    0 |       | SHOW FULL PROCESSLIST;
    (1 row)
  • SHOW INDEX语法示例
    -- 创建表和索引
    m_db=# CREATE TABLE t01 (c1 int PRIMARY KEY);
    
    -- 显示索引信息的语句
    m_db=# SHOW INDEX from t01;
     Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment 
    -------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------
     t01   |          0 | PRIMARY  |            1 | c1          | A         |           0 |          |        |      | UBTREE     |         | 
    (1 row)
  • SHOW VARIABLES语法示例
    -- 显示全局系统变量值
    m_db=# SHOW GLOBAL VARIABLES LIKE 'a_format%';
                  Variable_name               | Value 
    ------------------------------------------+-------
     a_format_copy_version                    | 
     a_format_date_timestamp                  | off
     a_format_dev_version                     | 
     a_format_disable_func                    | 
     a_format_load_with_constraints_violation | 
     a_format_version                         | 
    (6 rows)
    
    -- 显示对当前会话的系统变量值
    m_db=# SHOW SESSION VARIABLES LIKE 'query_%';
      Variable_name   |  Value  
    ------------------+---------
     query_max_mem    | 0
     query_dop        | 1
     query_mem        | 0
     query_cache_type | 0
     query_band       | 
     query_cache_size | 1048576
    (6 rows)
  • SHOW TABLES语法示例
    m_db=# CREATE SCHEMA sc_test;
    CREATE SCHEMA
    m_db=# USE sc_test;
    SET
    m_db=# CREATE TABLE t1(a int, b int);
    CREATE TABLE
    m_db=# CREATE TABLE t2(a int, b int);
    CREATE TABLE
    m_db=# SHOW TABLES;
     Tables_in_sc_test
    -------------------
     t1
     t2
    (2 rows)
    m_db=# SHOW FULL TABLES;
     Tables_in_sc_test | Table_type
    -------------------+------------
     t1                | BASE TABLE
     t2                | BASE TABLE
    (2 rows)
    
    m_db=# SHOW TABLES FROM sc_test;
     Tables_in_sc_test
    -------------------
     t1
     t2
    (2 rows)
    m_db=# SHOW TABLES LIKE "%1";
     Tables_in_sc_test (%1)
    ------------------------
     t1
    (1 row)
    
    m_db=# SHOW TABLES LIKE "t%";
     Tables_in_sc_test (t%)
    ------------------------
     t1
     t2
    (2 rows)
    
    m_db=# SHOW TABLES WHERE Tables_in_sc_test='t1';
     Tables_in_sc_test
    -------------------
     t1
    (1 row)
    m_db=# DROP SCHEMA sc_test;
    NOTICE:  drop cascades to 2 other objects
    DETAIL:  drop cascades to table sc_test.t1
    drop cascades to table sc_test.t2
    DROP SCHEMA
  • SHOW TABLE STATUS语法示例
    m_db=# CREATE SCHEMA sc_test;
    CREATE SCHEMA
    m_db=# USE sc_test;
    SET
    m_db=# CREATE TABLE t1(a int, b int);
    CREATE TABLE
    m_db=# CREATE TABLE t2(a int, b int);
    CREATE TABLE
    m_db=# SHOW TABLE STATUS;
     Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment |     Create_time     | Update_time | Check_time |     Collation      | Checksum |                               Create_options                                | Comment
    ------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+--------------------+----------+-----------------------------------------------------------------------------+---------
     t1   | Ustore |         |            | 0    |                | 0           |                 | 0            |           |                | 2024-04-21 15:56:25 |             |            | utf8mb4_general_ci |          | orientation=row compression=no storage_type=USTORE collate=1537 segment=off |
     t2   | Ustore |         |            |                | 0           |                 | 0            |           |                | 2024-04-21 15:56:32 |             |            | utf8mb4_general_ci |          | orientation=row compression=no storage_type=USTORE collate=1537 segment=off |
    (2 rows)
    
    m_db=# SHOW TABLE STATUS FROM sc_test;
     Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment |     Create_time     | Update_time | Check_time |     Collation      | Checksum |                               Create_options                                | Comment
    ------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+--------------------+----------+-----------------------------------------------------------------------------+---------
     t1   | Ustore |         |            | 0    |                | 0           |                 | 0            |           |                | 2024-04-21 15:56:25 |             |            | utf8mb4_general_ci |          | orientation=row compression=no storage_type=USTORE collate=1537 segment=off |
     t2   | Ustore |         |            | 0    |                | 0           |                 | 0            |           |                | 2024-04-21 15:56:32 |             |            | utf8mb4_general_ci |          | orientation=row compression=no storage_type=USTORE collate=1537 segment=off |
    (2 rows)
    
    m_db=# SHOW TABLE STATUS FROM sc_test LIKE 't%';
     Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment |     Create_time     | Update_time | Check_time |     Collation      | Checksum |                               Create_options                                | Comment
    ------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+--------------------+----------+-----------------------------------------------------------------------------+---------
     t1   | Ustore |         |            | 0    |                | 0           |                 | 0            |           |                | 2024-04-21 15:56:25 |             |            | utf8mb4_general_ci |          | orientation=row compression=no storage_type=USTORE collate=1537 segment=off |
     t2   | Ustore |         |            | 0    |                | 0           |                 | 0            |           |                | 2024-04-21 15:56:32 |             |            | utf8mb4_general_ci |          | orientation=row compression=no storage_type=USTORE collate=1537 segment=off |
    (2 rows)
    
    m_db=# SHOW TABLE STATUS FROM sc_test LIKE '%1';
     Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment |     Create_time     | Update_time | Check_time |     Collation      | Checksum |                               Create_options                                | Comment
    ------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+--------------------+----------+-----------------------------------------------------------------------------+---------
     t1   | Ustore |         |            | 0    |                | 0           |                 | 0            |           |                | 2024-04-21 15:56:25 |             |            | utf8mb4_general_ci |          | orientation=row compression=no storage_type=USTORE collate=1537 segment=off |
    (1 row)
                                                      ^
    m_db=# SHOW TABLE STATUS FROM sc_test WHERE Name='t1';
     Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment |     Create_time     | Update_time | Check_time |     Collation      | Checksum |                               Create_options                                | Comment
    ------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+--------------------+----------+-----------------------------------------------------------------------------+---------
     t1   | Ustore |         |            | 0    |                | 0           |                 | 0            |           |                | 2024-04-21 15:56:25 |             |            | utf8mb4_general_ci |          | orientation=row compression=no storage_type=USTORE collate=1537 segment=off |
    (1 row)
    
    m_db=# SHOW TABLE STATUS FROM sc_test WHERE Name LIKE 't%';
     Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment |     Create_time     | Update_time | Check_time |     Collation      | Checksum |                               Create_options                                | Comment
    ------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+--------------------+----------+-----------------------------------------------------------------------------+---------
     t1   | Ustore |         |            | 0    |                | 0           |                 | 0            |           |                | 2024-04-21 15:56:25 |             |            | utf8mb4_general_ci |          | orientation=row compression=no storage_type=USTORE collate=1537 segment=off |
     t2   | Ustore |         |            | 0    |                | 0           |                 | 0            |           |                | 2024-04-21 15:56:32 |             |            | utf8mb4_general_ci |          | orientation=row compression=no storage_type=USTORE collate=1537 segment=off |
    (2 rows)
    m_db=# DROP SCHEMA sc_test;
    NOTICE:  drop cascades to 2 other objects
    DETAIL:  drop cascades to table sc_test.t1
    drop cascades to table sc_test.t2
    DROP SCHEMA

相关链接

SETRESET

相关文档