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:
- Choose a table model: decide how data is stored, deduplicated, and aggregated.
- Define columns and data types: choose appropriate types for your business fields.
- Plan partitioning and bucketing: choose how rows are distributed and which filters can prune data.
- Add indexes: accelerate point queries, range scans, or full-text search.
- Optimize storage: evaluate compression, hybrid row-column storage, and the shared-storage and cache architecture.
- 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:
CREATE TABLE ... LIKE: reuse the structure of an existing table.CREATE TABLE ... AS SELECT(CTAS): create a table based on the result of a query.
Table name rules
Table-name case sensitivity and the name-length limit are controlled by managed warehouse settings:
| Setting | Purpose |
|---|---|
lower_case_table_names | Controls table-name case handling and cannot be changed after warehouse initialization |
table_name_length_limit | Limits 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.
| Option | Purpose |
|---|---|
BUCKETS | Sets the number of data shards in each partition |
compression | Chooses the column-page compression algorithm |
store_row_column | Stores an additional row representation for eligible query patterns |
storage_format | Selects 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, andstorage_policydo 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
Table Model Overview
Compare Duplicate Key, Unique Key, and Aggregate Key models to choose how to retain, update, or aggregate rows.
Duplicate Key Model
Preserve raw rows for logs and events when you do not need key-based updates or pre-aggregation.
Unique Key Model
Use primary keys to identify and update rows for CDC, order data, and other update workloads.
Aggregate Key Model
Pre-aggregate rows with the same key for reporting and multidimensional analysis.
Define columns and data types
Plan partitioning and bucketing
Partitioning and Bucketing Overview
Choose partitioning and bucketing strategies based on data lifecycle, filters, and query parallelism.
Basic Concepts
Learn how partitions, buckets, tablets, and replicas relate.
Manual Partitioning
Define partition boundaries explicitly when you need control over which values belong to each partition.
Dynamic Partitioning
Automatically create and reclaim partitions along the time dimension to simplify the operations of time-series tables.
Auto Partitioning
Automatically create partitions based on incoming data, eliminating the need to define partition ranges in advance.
Data Bucketing
Choose bucket keys and counts to limit skew and balance shard size with query parallelism.
Common Issues
Diagnose common partitioning and bucketing design problems.
Add indexes for query patterns
Index Overview
Compare index types and choose one that matches your query filters.
Prefix Index
Use the built-in sort-key index to prune data for eligible equality and range filters.
Bloom Filter Index
Accelerate equality queries on high-cardinality columns and reduce unnecessary data scans.
NGram Bloom Filter Index
Use n-grams to prune data for eligible substring searches.
Inverted Index (Full-Text Search)
Use keyword and phrase matching for log and text analysis.
Vector Index
Compare HNSW, IVF, and disk-backed IVF indexes for approximate nearest neighbor search.
Optimize storage
Storage Format
Learn about V3 segment storage and its availability starting from Core 26.1.1.
Data Compression
Choose an appropriate compression algorithm to balance storage cost and query performance.
Hybrid Row-Column Storage
Evaluate additional row storage for eligible point queries on wide tables.
Shared Storage and Local Cache
Understand warehouse object storage, cluster-local caches, and how they differ from self-managed tiering.
Plan schema changes
Schema Change
Add, drop, or modify columns, and distinguish metadata-only changes from background data rewrites.
Auto-Increment Column
Define an auto-increment column when creating a table, and understand generated ID behavior and limitations.
Special tables and best practices
Temporary Tables (Deprecated)
Review the deprecated temporary-table feature and its limitations. Avoid it in production.
Table Design Best Practices
Review recommendations for table models, key columns, partitioning, bucketing, and indexes.
Design considerations
| Design item | Constraint | Planning guidance |
|---|---|---|
| Table model | The model cannot be changed after table creation | Choose a table model before loading data |
| Bucket count | Existing partitions cannot be rebucketed in place. A new default applies to future partitions | Plan shard sizes and query parallelism. For existing data, evaluate partition replacement with a different bucket count |
| Column changes | Eligible value-column additions/deletions and VARCHAR length increases are lightweight. Other supported changes can require a data rewrite | Review schema-change constraints and monitor jobs. Completion time depends on the operation and workload |
| Storage and retention | Cache eviction leaves warehouse data in object storage. Dropping an expired partition removes its data from the table | Evaluate compression for storage use and dynamic partitioning for retention. Use cache warmup to prepare data for queries |