Doris creates tables and databases (defining partitions and indexes)
1. Create Tables and Databases
Doris is a high-performance columnar storage engine suitable for processing large datasets. It supports various data types, including numbers, strings, dates, and more.
In Doris, tables and databases are logical entities, and the basic units used to store and organize data are tablespaces. When creating a table or database, consider the following points:
- Table Name: The table name must be unique and should not contain special characters.
- Tablespace: The tablespace determines the physical memory occupied by the table.
- Partitioning: Partitioning can improve table performance and scalability.
- Indexing: Indexing can accelerate table queries.
2. Create Partitions
Doris supports the following types of partitions:
- range (Range Partitioning): Stores data based on ranges.
- hash (Hash Partitioning): Distributes data into different tablespaces according to a specific hash function.
- list (List Partitioning): Stores data based on splitting by one or more lists.
When creating partitions, consider the following points:
- Partitioner: Determine whether to use range, hash, or list partitioning.
- Column Name: Specify the column name to be used for partitioning.
- Tablespace: Specify the tablespace to be used for partitioning.
3. Create Indexes
Doris supports various types of indexes, including B+_tree indexes and hash indexes, among others. When creating indexes, consider the following points:
- Column Name: Specify the column on which to create the index.
- Type: Determine the data type of the index (e.g., numeric, string).
- Composite Index: Multiple columns can be combined to form a single index.
4. Use Tools to Create Tables and Databases
Doris provides various tools for creating tables and databases, including:
doris create tablecommand: Used to create a new table.doris create databasecommand: Used to create a new database.doris show tablecommand: Used to display table information.doris show indexcommand: Used to display index information.