Skip to main content
Skip to main content

Overview

Creating tables

Users can use the CREATE TABLE statement to create a table in Doris. You can also use the LIKE or AS clause to derive the table definition from another table.

Table name

In Doris, table names are case-sensitive by default. You can configure lower_case_table_namesto make them case-insensitive during the initial cluster setup. The default maximum length for table names is 64 bytes, but you can change this by configuring table_name_length_limit. It is not recommended to set this value too high. For syntax on creating tables, please refer to CREATE TABLE.

Table property

In the Doris CREATE TABLE statement, you can specify various table properties. Among them, the number of buckets (buckets), storage medium (storage_medium), replication num (replication_num), and hot/cold storage policy (storage_policy) properties apply to the partitions. That is, once a partition is created, it will have its own set of properties. Modifying the table properties will only affect partitions created in the future, and will not apply retroactively to partitions that have already been created. For more information about these properties, please refer to modifying table properties

Notes

  1. The data model cannot be changed, so you need to choose an appropriate data model when creating the table.

  2. The number of buckets for an existing partition cannot be modified. You can change the number of buckets by replacing the partition. However, you can modify the number of buckets for partitions that have not yet been created under dynamic partitioning.

  3. Adding or removing VALUE columns is a lightweight operation and can be completed in seconds. Adding or removing KEY columns or modifying data types is a heavyweight operation, and the completion time depends on the amount of data. It is best to avoid adding or removing KEY columns or modifying data types with large amounts of data.

  4. You can use tiered storage to save cold data to HDD or S3 / HDFS.