Skip to main content

Table Design Guide

Table design affects write performance, query efficiency, and storage use in a VeloDB Cloud warehouse. Use this guide to design a new table or improve an existing one.

Design workflow​

Design a table in the following order:

  1. Choose a table model: decide how data is stored, deduplicated, and aggregated.
  2. Define columns and data types: choose appropriate types for your business fields.
  3. Plan partitioning and bucketing: choose how rows are distributed and which filters can prune data.
  4. Add indexes: accelerate point queries, range scans, or full-text search.
  5. Optimize storage: evaluate compression, hybrid row-column storage, and the shared-storage and cache architecture.
  6. Plan schema changes: account for future column changes, and define an auto-increment column at creation if you need generated IDs.

Create a table​

Use CREATE TABLE to create a table in a warehouse database. To derive a new table from an existing one, you can use:

Table name rules​

Table-name case sensitivity and the name-length limit are controlled by managed warehouse settings:

SettingPurpose
lower_case_table_namesControls table-name case handling and cannot be changed after warehouse initialization
table_name_length_limitLimits table-name length

Use SHOW GLOBAL VARIABLES LIKE 'lower_case_table_names' to inspect case handling. To confirm the name-length limit or discuss naming requirements before creating a warehouse, contact VeloDB Cloud support. These settings are not table properties.

Key table options​

Set the bucket count in the DISTRIBUTED BY ... BUCKETS clause and storage options in PROPERTIES. The table below summarizes common options. See CREATE TABLE for syntax and constraints.

OptionPurpose
BUCKETSSets the number of data shards in each partition
compressionChooses the column-page compression algorithm
store_row_columnStores an additional row representation for eligible query patterns
storage_formatSelects the segment storage format, subject to the warehouse's Core version

Note:

Warehouse data resides in shared object storage, while clusters cache data locally. replication_num, storage_medium, and storage_policy do not configure Cloud data replicas, local disk placement, or archival tiers. See Tiered Storage Overview for the differences from self-managed Apache Doris.

The scope of an alteration depends on the option. For example, changing the default bucket count affects future partitions, while dynamic_partition.buckets controls new dynamic partitions. Do not assume every table property is a partition property or that every alteration affects only future partitions. See ALTER TABLE PROPERTY and ALTER TABLE DISTRIBUTION for each option's behavior.

Choose a table model​

Define columns and data types​

Plan partitioning and bucketing​

Add indexes for query patterns​

Optimize storage​

Plan schema changes​

Special tables and best practices​

Design considerations​

Design itemConstraintPlanning guidance
Table modelThe model cannot be changed after table creationChoose a table model before loading data
Bucket countExisting partitions cannot be rebucketed in place. A new default applies to future partitionsPlan shard sizes and query parallelism. For existing data, evaluate partition replacement with a different bucket count
Column changesEligible value-column additions/deletions and VARCHAR length increases are lightweight. Other supported changes can require a data rewriteReview schema-change constraints and monitor jobs. Completion time depends on the operation and workload
Storage and retentionCache eviction leaves warehouse data in object storage. Dropping an expired partition removes its data from the tableEvaluate compression for storage use and dynamic partitioning for retention. Use cache warmup to prepare data for queries

Enter to send · Shift+Enter for a new line