Command overview

Updated at:
Copy as MD

Lindorm provides a set of Data Definition Language (DDL) commands to define and manage the structure of database objects, such as databases, tables, and indexes.

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

Important

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

The following table lists only permissions other than ALL.

Category

Command

Description

Permissions

Permission granularity

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 sets its properties.

ADMIN

GLOBAL

ALTER DATABASE

Modifies the properties of a database.

ADMIN

GLOBAL

DROP DATABASE

Deletes a specified database.

Requires the READ and ADMIN permissions.

GLOBAL

SHOW DATABASES

Lists all databases in the current instance.

  • READ

  • WRITE

  • ADMIN

  • GLOBAL

  • DATABASE

  • TABLE

Table management

CREATE TABLE

Creates a table and sets its properties.

ADMIN

  • GLOBAL

  • DATABASE

CREATE TABLE LIKE

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

Requires the READ and ADMIN permissions.

DATABASE

ALTER TABLE

Modifies the structure of a table, for example, by adding or dropping columns, changing data types, or adding a table property.

Requires the READ and ADMIN permissions.

DATABASE

DROP TABLE

Deletes a specified table.

Requires the ADMIN and TRASH permissions.

DATABASE

TRUNCATE TABLE

Quickly removes all data from a table but preserves the table structure and indexes.

Requires the ADMIN and TRASH permissions.

DATABASE

SHOW TABLES

Lists all tables in a database that match the query conditions.

  • READ

  • GLOBAL

  • DATABASE

SHOW CREATE TABLE

Retrieves the CREATE TABLE statement for a specified table.

Requires the READ and ADMIN permissions.

DATABASE

OFFLINE TABLE

Takes a specified table offline. An offline table cannot be read from or written to.

ADMIN

  • GLOBAL

  • DATABASE

ONLINE TABLE

Brings a specified table online. An online table can be read from and written to.

ADMIN

  • GLOBAL

  • DATABASE

Index management

CREATE INDEX

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

Requires the READ and ADMIN permissions.

DATABASE

ALTER INDEX

Changes the status of an index or adds columns to an index.

Requires the 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, you must run this command to build the secondary index after creating the index.

Requires the READ and ADMIN permissions.

DATABASE

DROP INDEX

Deletes a specified index.

Requires the READ, ADMIN, and TRASH permissions.

DATABASE

SHOW INDEX

Displays information about the indexes on a specified table, such as index type and build progress.

Requires the READ and ADMIN permissions.

DATABASE

System property modification

ALTER SYSTEM

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

ADMIN

GLOBAL

System and table property view

SHOW VARIABLES

Displays system properties or the properties of a specific table.

READ

GLOBAL

SQL query process management

SHOW PROCESSLIST

Displays 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