Display column names, data types, and table engine details using DESCRIBE TABLE, SHOW CREATE, or system tables.
Run DESCRIBE TABLE customers;
(alias DESC
). The server returns column names, data types, default expressions, and codecs in the original order—ideal for a quick glance.
Use SHOW CREATE TABLE customers;
to see engine, order by, partitioning, and setting clauses. Copy-paste the output to recreate the table elsewhere.
system.columns
directly?Querying system.columns
lets you filter or aggregate metadata. Example: SELECT name, type FROM system.columns WHERE database='shop' AND table='orders';
. Use it in scripts that examine many tables at once.
Execute SHOW TABLES FROM shop;
. Combine with SHOW CREATE
inside a loop to export every schema in the database.
SHOW CREATE TABLE distributed_orders;
reveals the underlying remote databases and sharding key, helping you troubleshoot data locality issues.
Prefix commands with the database name to avoid surprises (DESC shop.customers
). Export schemas to version control using SHOW CREATE
. Automate checks with system.columns
.
Relying only on DESCRIBE
misses engine settings—always cross-check with SHOW CREATE
. Forgetting the database name can return the wrong table; qualify objects explicitly.
Yes. Run SHOW CREATE TABLE view_name;
because materialized views are stored as tables internally. The output includes its SELECT query.
ClickHouse exposes metadata through the system
database. Tables such as system.tables
and system.columns
act as an information schema.
Iterate over SELECT name FROM system.tables WHERE database='shop'
in your scripting language. For each name, execute SHOW CREATE TABLE shop.{name}
and write the DDL to files.