📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

system.tables



Provides metadata information for all tables. It includes details such as table properties, creation time, number of rows, data size, and more.

See also:

SELECT * FROM system.tables LIMIT 3; ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐ │ catalog │ database │ name │ table_id │ total_columns │ engine │ engine_full │ cluster_by │ is_transient │ is_attach │ created_on │ dropped_on │ updated_on │ num_rows │ data_size │ data_compressed_size │ index_size │ number_of_segments │ number_of_blocks │ owner │ comment │ table_type │ ├─────────┼──────────┼────────────────────┼─────────────────────┼───────────────┼───────────────────────┼───────────────────────┼────────────┼──────────────┼───────────┼────────────────────────────┼─────────────────────┼────────────────────────────┼──────────────────┼──────────────────┼──────────────────────┼──────────────────┼────────────────────┼──────────────────┼──────────────────┼─────────┼────────────┤ │ defaultsystem │ metrics │ 46116860184273879195 │ SystemMetrics │ SystemMetrics │ │ │ │ 2024-11-20 21:04:12.950815NULL2024-11-20 21:04:12.950815NULLNULLNULLNULLNULLNULLNULL │ │ BASE TABLE │ │ defaultsystem │ clustering_history │ 46116860184273879256 │ SystemLogTable │ SystemLogTable │ │ │ │ 2024-11-20 21:04:12.952439NULL2024-11-20 21:04:12.952439NULLNULLNULLNULLNULLNULLNULL │ │ BASE TABLE │ │ defaultsystem │ queries_profiling │ 46116860184273879417 │ QueriesProfilingTable │ QueriesProfilingTable │ │ │ │ 2024-11-20 21:04:12.952588NULL2024-11-20 21:04:12.952588NULLNULLNULLNULLNULLNULLNULL │ │ BASE TABLE │ └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

To show the schema of system.tables, use DESCRIBE system.tables:

DESCRIBE system.tables; ┌─────────────────────────────────────────────────────────────────────────────────────────┐ │ Field │ Type │ NullDefault │ Extra │ ├──────────────────────┼─────────────────┼────────┼──────────────────────────────┼────────┤ │ catalog │ VARCHARNO'' │ │ │ database │ VARCHARNO'' │ │ │ name │ VARCHARNO'' │ │ │ table_id │ BIGINT UNSIGNED │ NO0 │ │ │ total_columns │ BIGINT UNSIGNED │ NO0 │ │ │ engine │ VARCHARNO'' │ │ │ engine_full │ VARCHARNO'' │ │ │ cluster_by │ VARCHARNO'' │ │ │ is_transient │ VARCHARNO'' │ │ │ is_attach │ VARCHARNO'' │ │ │ created_on │ TIMESTAMPNO'1970-01-01 00:00:00.000000' │ │ │ dropped_on │ TIMESTAMP │ YES │ NULL │ │ │ updated_on │ TIMESTAMPNO'1970-01-01 00:00:00.000000' │ │ │ num_rows │ BIGINT UNSIGNED │ YES │ NULL │ │ │ data_size │ BIGINT UNSIGNED │ YES │ NULL │ │ │ data_compressed_size │ BIGINT UNSIGNED │ YES │ NULL │ │ │ index_size │ BIGINT UNSIGNED │ YES │ NULL │ │ │ number_of_segments │ BIGINT UNSIGNED │ YES │ NULL │ │ │ number_of_blocks │ BIGINT UNSIGNED │ YES │ NULL │ │ │ owner │ VARCHAR │ YES │ NULL │ │ │ comment │ VARCHARNO'' │ │ │ table_type │ VARCHARNO'' │ │ └─────────────────────────────────────────────────────────────────────────────────────────┘

Was this page helpful?