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

Table



This page provides a comprehensive overview of table operations in TiDB Cloud Lake, organized by functionality for easy reference.

Table Creation

CommandDescription
CREATE TABLECreates a new table with specified columns and options
CREATE TABLE ... LIKECreates a table with the same column definitions as an existing one
CREATE TABLE ... ASCreates a table and inserts data based on the results of a SELECT query
CREATE TRANSIENT TABLECreates a table without Time Travel support
CREATE EXTERNAL TABLECreates a table with data stored in a specified external location
ATTACH TABLECreates a table by associating it with an existing table

Table Modification

CommandDescription
ALTER TABLEModifies table columns, comments, Fuse options, external connections, or swaps metadata with another table
RENAME TABLEChanges the name of a table

Table Information

CommandDescription
DESCRIBE TABLE / SHOW FIELDSShows information about the columns in a given table
SHOW FULL COLUMNSRetrieves comprehensive details about the columns in a given table
SHOW CREATE TABLEShows the CREATE TABLE statement that creates the named table
SHOW TABLESLists the tables in the current or a specified database
SHOW TABLE STATUSShows the status of the tables in a database
SHOW DROP TABLESLists the dropped tables in the current or a specified database

Table Deletion & Recovery

CommandDescriptionRecovery Option
TRUNCATE TABLERemoves all data from a table while preserving the table's schemaFLASHBACK TABLE
DROP TABLEDeletes a tableUNDROP TABLE
VACUUM TABLEPermanently removes historical data files of a table (Enterprise Edition)Not recoverable
VACUUM DROP TABLEPermanently removes data files of dropped tables (Enterprise Edition)Not recoverable

Table Optimization

CommandDescription
OPTIMIZE TABLECompacts or purges historical data to save storage space and enhance query performance
SET CLUSTER KEYConfigures a cluster key to enhance query performance for large tables

Was this page helpful?