SHOW
Description
SHOW displays information about database objects, configuration, sessions, and diagnostics.
Common syntax
SHOW {DATABASES | SCHEMAS} [STATUS] [LIKE 'pattern' | WHERE expr];
SHOW [FULL] TABLES [FROM database_name]
[LIKE 'pattern' | WHERE expr];
SHOW [EXTENDED] [FULL] {COLUMNS | FIELDS}
FROM table_name [FROM database_name]
[LIKE 'pattern' | WHERE expr];
SHOW [EXTENDED] {INDEX | INDEXES | KEYS}
FROM table_name [FROM database_name];
SHOW CREATE {DATABASE | TABLE | VIEW | PROCEDURE | FUNCTION} object_name;
SHOW {GLOBAL | SESSION | LOCAL} VARIABLES
[LIKE 'pattern' | WHERE expr];
SHOW {GLOBAL | SESSION | LOCAL} STATUS
[LIKE 'pattern' | WHERE expr];
SHOW {CHARSET | CHARACTER SET} [LIKE 'pattern' | WHERE expr];
SHOW COLLATION [LIKE 'pattern' | WHERE expr];
SHOW PARAMETERS [LIKE 'pattern' | WHERE expr];
SHOW [FULL] PROCESSLIST;
SHOW {WARNINGS | ERRORS} [LIMIT row_count];
SHOW COUNT(*) {WARNINGS | ERRORS};
SHOW GRANTS [FOR user_name];
SHOW ENGINES;
SHOW PRIVILEGES;
SHOW RECYCLEBIN;
SHOW SEQUENCE [LIKE 'pattern' | WHERE expr];
SHOW TRACE [FORMAT='JSON'];
Notes
FULLincludes additional columns or complete SQL text.EXTENDEDincludes system-generated hidden objects in column and index results.LIKEandWHEREfilter the result.SHOW PARAMETERSdisplays instance configuration items. You can also queryoceanbase.V$OB_PARAMETERS.SHOW [FULL] PROCESSLISTandINFORMATION_SCHEMA.PROCESSLISTshow only your own sessions unless you have the globalPROCESSprivilege. A direct grant or an enabled role withPROCESSlets you view other users’ sessions.SHOW TRACEdisplays execution stages for the most recent traced SQL statement in the current session. ExecuteSET ob_enable_show_trace = 1before using it.
Examples
View databases, tables, columns, indexes, and a table definition:
SHOW DATABASES;
SHOW FULL TABLES FROM test;
SHOW COLUMNS FROM test.t1;
SHOW INDEX FROM test.t1;
SHOW CREATE TABLE test.t1;
View the supported character sets:
SHOW CHARSET;
+---------+-----------------------+--------------------+--------+
| Charset | Description | Default collation | Maxlen |
+---------+-----------------------+--------------------+--------+
| binary | Binary pseudo charset | binary | 1 |
| utf8mb4 | UTF-8 Unicode | utf8mb4_general_ci | 4 |
+---------+-----------------------+--------------------+--------+
View supported collations:
SHOW COLLATION;
+--------------------+---------+-----+---------+----------+---------+
| Collation | Charset | Id | Default | Compiled | Sortlen |
+--------------------+---------+-----+---------+----------+---------+
| utf8mb4_general_ci | utf8mb4 | 45 | Yes | Yes | 1 |
| utf8mb4_bin | utf8mb4 | 46 | | Yes | 1 |
| utf8mb4_unicode_ci | utf8mb4 | 224 | | Yes | 8 |
| binary | binary | 63 | Yes | Yes | 1 |
+--------------------+---------+-----+---------+----------+---------+
4 rows in set
View the log-level configuration item:
SHOW PARAMETERS LIKE 'syslog_level';
View current connections and session status:
SHOW FULL PROCESSLIST;
SHOW SESSION STATUS LIKE 'Threads_connected';
View an execution trace:
SET ob_enable_show_trace = 1;
SELECT COUNT(*) FROM test.t1;
SHOW TRACE FORMAT='JSON';
ShowTraceJSON contains durations and correlation identifiers for stages such as parsing, optimization, and execution. Values vary with the SQL statement and runtime environment.