DDL

Updated at:
Copy as MD

Lindorm provides DDL statements for defining and managing database objects such as databases, tables, and indexes.

The following table lists the supported DDL statements, required permissions, and permission granularities.

Important

Granting the ALL or ALL PRIVILEGES permission also grants the READ, WRITE, ADMIN, and TRASH permissions.

The following table lists only non-ALL permissions.

Category

Command

Description

Required permissions

Supported permission granularities

Database and table schema query

DESCRIBE

Queries the schema of a table or database.

READ

  • GLOBAL

  • DATABASE

Database management

USE

Switches the current database.

  • READ

  • WRITE

  • ADMIN

  • GLOBAL

  • DATABASE

  • TABLE

CREATE DATABASE

Creates a database and configures its properties.

ADMIN

GLOBAL

ALTER DATABASE

Modifies the properties of a database.

ADMIN

GLOBAL

DROP DATABASE

Deletes a database.

Requires both READ and ADMIN permissions

GLOBAL

SHOW DATABASES

Shows all databases in the current instance.

  • READ

  • WRITE

  • ADMIN

  • GLOBAL

  • DATABASE

  • TABLE

Table management

CREATE TABLE

Creates a table and configures its properties.

ADMIN

  • GLOBAL

  • DATABASE

CREATE TABLE LIKE

Creates a new table with the same schema as an existing table.

Requires both READ and ADMIN permissions

DATABASE

ALTER TABLE

Modifies the schema of a table, such as adding or deleting columns, changing data types, or setting table properties.

Requires both READ and ADMIN permissions

DATABASE

DROP TABLE

Deletes a table.

Requires both ADMIN and TRASH permissions

DATABASE

TRUNCATE TABLE

Clears all data from a table while preserving its schema and indexes.

Requires both ADMIN and TRASH permissions

DATABASE

SHOW TABLES

Shows all tables in a database that match the specified conditions.

  • READ

  • GLOBAL

  • DATABASE

SHOW CREATE TABLE

Retrieves the CREATE TABLE statement for a table.

Requires both READ and ADMIN permissions

DATABASE

OFFLINE TABLE

Takes a table offline. After a table is taken offline, it cannot be read from or written to.

ADMIN

  • GLOBAL

  • DATABASE

ONLINE TABLE

Brings a table back online. After a table is brought online, it can be read from and written to.

ADMIN

  • GLOBAL

  • DATABASE

Index management

CREATE INDEX

Creates a secondary index, search index, or columnstore index, and configures index properties.

Requires both READ and ADMIN permissions

DATABASE

ALTER INDEX

Changes the index status or adds an index column.

Requires both READ and ADMIN permissions

DATABASE

BUILD INDEX

Builds a secondary index. For LindormTable versions later than 2.2.16 and up to 2.6.3, run this command to build the secondary index after submitting the index creation command.

Requires both READ and ADMIN permissions

DATABASE

DROP INDEX

Deletes an index.

Requires READ, ADMIN, and TRASH permissions

DATABASE

SHOW INDEX

Shows the index information for a specific table, such as the index type and build progress.

Requires both READ and ADMIN permissions

DATABASE

System property modification

ALTER SYSTEM

Modifies dynamic system configuration parameters, such as the file version number and slow query view.

ADMIN

GLOBAL

System and table property view

SHOW VARIABLES

Shows system properties or the properties of a specific table.

READ

GLOBAL

SQL query process management

SHOW PROCESSLIST

Shows currently running SQL statements and their details.

  • READ

  • WRITE

  • ADMIN

  • GLOBAL

  • DATABASE

  • TABLE

KILL QUERY

Terminates a running SQL statement.

  • READ

  • WRITE

  • ADMIN

  • GLOBAL

  • DATABASE

  • TABLE