SHOW statements
Every SHOW statement the Raft DB parser accepts, what it returns here, and the SHOW statements that are refused.
SHOW statements list databases, tables, columns, indexes, definitions, variables and other metadata. GUI tools and drivers use them to fill their object browsers.
Syntax#
SHOW { DATABASES | SCHEMAS } [LIKE 'pattern']
SHOW [FULL] TABLES [{ FROM | IN } db_name] [LIKE 'pattern' | WHERE expr]
SHOW [FULL] { COLUMNS | FIELDS } { FROM | IN } tbl_name [{ FROM | IN } db_name]
[LIKE 'pattern' | WHERE expr]
SHOW { INDEX | INDEXES | KEYS } { FROM | IN } tbl_name [{ FROM | IN } db_name]
SHOW CREATE TABLE tbl_name
SHOW CREATE VIEW view_name
SHOW CREATE SEQUENCE seq_name
SHOW CREATE { DATABASE | SCHEMA } [IF NOT EXISTS] db_name
SHOW CREATE { PROCEDURE | FUNCTION } routine_name
SHOW CREATE TRIGGER trigger_name
SHOW GRANTS [FOR account]
SHOW [GLOBAL | SESSION] VARIABLES [LIKE 'pattern']
SHOW [GLOBAL | SESSION] STATUS [LIKE 'pattern']
SHOW WARNINGS
SHOW ERRORS
SHOW ENGINES
SHOW { CHARACTER SET | CHARSET } [LIKE 'pattern' | WHERE expr]
SHOW COLLATION [LIKE 'pattern' | WHERE expr]
SHOW TABLE STATUS [{ FROM | IN } db_name] [LIKE 'pattern' | WHERE expr]
SHOW { PROCEDURE | FUNCTION } STATUS [{ FROM | IN } db_name] [LIKE 'pattern' | WHERE expr]
SHOW TRIGGERS [{ FROM | IN } db_name] [LIKE 'pattern' | WHERE expr]
SHOW EVENTS [{ FROM | IN } db_name] [LIKE 'pattern' | WHERE expr]
SHOW OPEN TABLES [{ FROM | IN } db_name] [LIKE 'pattern' | WHERE expr]
SHOW PLUGINS [LIKE 'pattern' | WHERE expr]
SHOW PROCESSLISTGLOBAL and SESSION after SHOW are accepted on any form.
Arguments#
| Name | Meaning | Default |
|---|---|---|
FULL | SHOW FULL TABLES adds Table_type (BASE TABLE, VIEW, SEQUENCE); SHOW FULL COLUMNS adds collation, privileges and comment columns. | off |
LIKE 'pattern' | Filter by name (% and _). The column header shows the pattern, e.g. Tables_in_db (r%), Database (p). | none |
WHERE expr | Filter on the columns of the answer by their names (Field, Type, Table_type, Db, ...). | none |
Remarks#
- What is real.
SHOW DATABASES,TABLES,COLUMNS,INDEX,CREATE TABLE/VIEW/SEQUENCE/DATABASE/PROCEDURE/FUNCTION/TRIGGER,GRANTS,TABLE STATUS,PROCEDURE STATUS,FUNCTION STATUS,TRIGGERS,CHARACTER SET,COLLATION,WARNINGSandERRORSdescribe what exists.SHOW CHARACTER SETandSHOW COLLATIONgive the real lists of each server (41 and 286 rows for MySQL 9.7; 40 and 550 for MariaDB 11.4). - What is a fixed or empty answer.
SHOW ENGINEShas one row (InnoDB, DEFAULT, "Raft DB stores every table; there is one engine").SHOW STATUShas three fixed rows (Uptime,Threads_connected,Questions).SHOW EVENTSandSHOW OPEN TABLESare empty (there are no events).SHOW PLUGINSlists the two password plugins.SHOW PROCESSLISTshows the current connection only.SHOW TABLE STATUSgivesRows0 and the other sizes 0 (the engine reports no estimates). SHOW VARIABLESlists the session's variables of the dialect (513 for MySQL 9.7, 554 for MariaDB 11.4). See system variables.SHOW CREATE TABLEprints what the chosen dialect's server prints, with the generated, invisible, check and foreign-key parts;AUTO_INCREMENT=nis shown. Unique indexes are listed before the others. The character-set introducer printed for string literals in checks is_utf8mb4.SHOW CREATE VIEWprints the stored text, not MySQL's canonical text.SHOW INDEX:Cardinalityis 0 (MySQL's value is an estimate);Visibleshows invisible indexes; a functional index showsColumn_name NULLand the expression inExpression.- Differences between the dialects.
SHOW PROCEDURE STATUShas aLanguagecolumn in MySQL only. MariaDB lists databases in one alphabetical order; MySQL listsinformation_schemafirst.SHOW COLLATIONhas noPad_attributecolumn in MariaDB.SHOW TABLESlists sequences with typeSEQUENCE. - A temporary table is not listed by
SHOW TABLESbut is shown bySHOW COLUMNS,SHOW CREATE TABLEandSHOW INDEX. - Privileges.
SHOW DATABASES,SHOW TABLES,DESCRIBEandinformation_schemashow only what the account may see.SHOW CREATE TABLEneeds some privilege on the table (denial text usesSHOW).SHOW GRANTS FORanother account needs the privileges MySQL asks for.
Not supported yet#
SHOW PRIVILEGES and SHOW CREATE USER account are answered as the servers answer them. A server without a binary log and without replicas is what Raft DB looks like: SHOW BINARY LOGS is error 1381 (MariaDB also SHOW MASTER LOGS); SHOW BINLOG EVENTS, SHOW MASTER STATUS / SHOW BINARY LOG STATUS, SHOW REPLICAS / SHOW SLAVE HOSTS, SHOW REPLICA STATUS / SHOW SLAVE STATUS and SHOW PROFILES / SHOW PROFILE are empty, and the spelling the dialect does not have (MySQL 9 has no MASTER or SLAVE; MariaDB no REPLICAS) is a syntax error as in MySQL.
Every other SHOW is refused with error 1235 ("this SHOW statement"), among them: SHOW ENGINE ... STATUS, SHOW CREATE EVENT, SHOW COUNT(*) WARNINGS, SHOW RELAYLOG EVENTS, SHOW PARSE_TREE, SHOW STATUS with the server's own counters.
Examples#
Example:
SHOW TABLES;
SHOW FULL TABLES FROM db12 WHERE table_type = 'BASE TABLE';
SHOW TRIGGERS FROM db12;
SHOW PROCEDURE STATUS WHERE db = 'db12';
SHOW CREATE DATABASE db12;
SHOW FULL COLUMNS FROM t;
SHOW CREATE TABLE t;
SHOW COLLATION LIKE 'utf8mb4_general%';
SHOW VARIABLES LIKE 'character_set_server';
SHOW DATABASES LIKE 'p'; -- header: Database (p)
SHOW TABLES LIKE 'r%';