Query the table definition

2024-04-19 08:42:50  Updated

After you create a table, you can query its definition by using SQL statements.

The following example shows how to query the definition of a table by using the SHOW CREATE TABLE statement.

obclient> SHOW CREATE TABLE test;
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                                                                                                                                                 |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| test  | CREATE TABLE `test` (
  `id` int(11) DEFAULT NULL,
  `name` char(1) DEFAULT NULL
) DEFAULT CHARSET = utf8mb4 ROW_FORMAT = DYNAMIC COMPRESSION = 'zstd_1.3.8' REPLICA_NUM = 1 BLOCK_SIZE = 16384 USE_BLOOM_FILTER = FALSE TABLET_SIZE = 134217728 PCTFREE = 0 |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)

where

  • DEFAULT CHARSET = utf8mb4 indicates that the default character set is utf8mb4.

  • ROW_FORMAT = DYNAMIC indicates that data encoding is enabled.

  • COMPRESSION indicates the compression method of the table.

  • PCTFREE indicates the space reserved for updating this data block.

Contact Us