Data Bucketing
A partition can be further divided into multiple data buckets according to business requirements. Each bucket is stored as a physical data shard (Tablet). A reasonable bucketing strategy can effectively reduce the amount of data scanned at query time, improve query performance, and increase concurrent processing capability.
Choose the distribution method first, then the hash key if needed, and finally a bucket count. Verify tablet sizes and query performance with representative data before applying the design broadly.
Quick decision
When you create a table, you can complete the bucketing design in the following order:
| Step | Decision Item | Key Considerations |
|---|---|---|
| 1 | Choose the bucketing method | Whether there are high-frequency filter columns, whether the data is evenly distributed, and the table model |
| 2 | Select the bucket key (Hash bucketing only) | Query filter conditions, column cardinality, query concurrency and throughput characteristics |
| 3 | Determine the number of buckets | Data size per tablet and compute-cluster capacity |
| 4 | Plan the bucket maintenance strategy | Data growth trend, whether dynamic partitioning is used |
1. Choose the bucketing method
The query engine supports two bucketing methods: Hash bucketing and Random bucketing. Their core differences are as follows:
| Comparison Item | Hash Bucketing | Random Bucketing |
|---|---|---|
| Data distribution method | Divided by the Hash value of the bucket key | Random assignment across buckets |
| Whether a bucket key is required | Required | Not required |
| Whether bucket pruning is supported | Supported | Not supported |
| Applicable table models | DUPLICATE / UNIQUE / AGGREGATE | DUPLICATE only |
| Risk of data skew | Depends on the choice of bucket key | Lower |
| Applicable scenarios | Point queries that frequently filter by a specific column | Analysis on arbitrary dimensions, data prone to skew |
1. Hash bucketing
When you create a table or add a new partition, you need to choose one or more columns as the bucket key and explicitly specify the number of buckets. Within the same partition, the system performs a Hash calculation based on the bucket key and the number of buckets, and rows with the same Hash value are assigned to the same bucket.
For example, in the figure below, the p250102 partition is divided into 3 buckets by the region column, and rows with the same Hash value are placed in the same bucket.

Recommended scenarios:
- When the business frequently filters on a specific field, you can use that field as the bucket key and leverage bucket pruning to improve query efficiency.
- The data in the table is relatively evenly distributed and unlikely to be skewed.
Example: Create a table with Hash bucketing. For detailed syntax, see CREATE TABLE.
Run the examples with a warehouse SQL account that can create databases and tables. The examples qualify table names with the demo database. Create it first if needed:
CREATE DATABASE IF NOT EXISTS demo;
CREATE TABLE demo.hash_bucket_tbl(
oid BIGINT,
dt DATE,
region VARCHAR(10),
amount INT
)
DUPLICATE KEY(oid)
PARTITION BY RANGE(dt) (
PARTITION p250101 VALUES LESS THAN("2025-01-01"),
PARTITION p250102 VALUES LESS THAN("2025-01-02")
)
DISTRIBUTED BY HASH(region) BUCKETS 8;
In the example, DISTRIBUTED BY HASH(region) specifies the use of Hash bucketing and selects the region column as the bucket key. BUCKETS 8 specifies the creation of 8 buckets.
2. Random bucketing
Random bucketing randomly distributes data across the buckets within each partition, without relying on the Hash value of any field. This avoids skew caused by a poorly chosen hash key, although random assignment does not guarantee identical tablet sizes.
When data is loaded, each batch in a single load job is randomly written to a Tablet, which spreads writes across tablets over multiple batches. For example, in the figure below, 8 batches of data are randomly assigned to 3 buckets under the p250102 partition.

When using Random bucketing, you can enable single-tablet load mode (set load_to_single_tablet to true), so that the data of a single batch is written to only one data shard. This can:
- Improve the concurrency and throughput of large-scale data loads.
- Reduce write amplification caused by data loading and Compaction operations.
- Improve cluster stability.
Recommended scenarios:
- Analysis on arbitrary dimensions, where the business has no fixed filter or join columns.
- The data distribution of frequently queried columns or column combinations is highly uneven, and data skew must be avoided.
Unsuitable scenarios:
- Point query scenarios: Random bucketing cannot perform pruning based on the bucket key, so it scans all data in the matched partitions.
- UNIQUE and AGGREGATE tables: only DUPLICATE tables support Random bucketing.
Example: Create a table with Random bucketing. For detailed syntax, see CREATE TABLE.
CREATE TABLE demo.random_bucket_tbl(
oid BIGINT,
dt DATE,
region VARCHAR(10),
amount INT
)
DUPLICATE KEY(oid)
PARTITION BY RANGE(dt) (
PARTITION p250101 VALUES LESS THAN("2025-01-01"),
PARTITION p250102 VALUES LESS THAN("2025-01-02")
)
DISTRIBUTED BY RANDOM BUCKETS 8;
In the example, DISTRIBUTED BY RANDOM specifies the use of Random bucketing and does not require selecting a bucket key. BUCKETS 8 specifies the creation of 8 buckets.
2. Select the bucket key
Tip:
Only Hash bucketing requires selecting a bucket key. Random bucketing does not.
The bucket key can consist of one or more columns. Different table models impose the following restrictions on the bucket key:
| Table Model | Eligible Bucket Keys |
|---|---|
| DUPLICATE | Any Key column or Value column |
| AGGREGATE / UNIQUE | Must be Key columns (to ensure correct data aggregation) |
Selection principles
Based on business query characteristics, you can refer to the following principles when selecting a bucket key:
| Principle | Description | Benefit |
|---|---|---|
| Leverage query filter conditions | Choose columns that frequently appear as filters in queries as the bucket key | Supports bucket pruning and reduces the amount of data scanned |
| Leverage high-cardinality columns | Choose columns with many distinct values as the bucket key | Data is evenly distributed and skew is avoided |
| High-concurrency point query scenarios | Choose a single column or a small number of columns as the bucket key | A single query triggers a scan of only one bucket, reducing IO interference between queries |
| High-throughput query scenarios | Choose multiple columns as the bucket key | Data is more evenly distributed; when the query conditions cannot fully match the equality conditions, overall throughput is improved |
3. Determine the number of buckets
A bucket corresponds to a tablet within each partition and index. For a table's base index, if every partition uses the same bucket count, the tablet count is:
Total Tablets = partition_num × bucket_num
Warning:
The bucket count of an existing partition cannot be changed. Plan for expected data growth and changes in compute capacity when choosing it.
Use an explicit bucket count when you can estimate partition size and validate the result. Use automatic bucketing when you want the engine to infer a count. Automatic bucketing sizes new partitions. It does not resize existing ones.
1. Set the bucket count manually
Specify the number of buckets through the DISTRIBUTED clause:
-- Set hash bucket num to 8
DISTRIBUTED BY HASH(region) BUCKETS 8
-- Set random bucket num to 8
DISTRIBUTED BY RANDOM BUCKETS 8
Sizing principles
When determining the number of buckets, follow the two principles below. When they conflict, prioritize the size principle:
-
Size principle: The compressed data size of each Tablet (excluding indexes) is recommended to stay between 1 GB and 20 GB, and no more than 10 GB for Unique Key tables.
- Tablets that are too small: aggregation is less effective, and metadata management overhead increases.
- Tablets that are too large: operations on an individual tablet involve more data, and retrying a failed schema change can cost more work.
- You can use
SHOW TABLETS FROM your_tableto check the actual Tablet sizes.
-
Parallelism principle: Provide enough tablets to use the compute capacity available to the workload, while avoiding many tiny tablets. Measure scan parallelism and load performance rather than sizing from backend disk counts.
Warning:
Consider the row count of each MOW tablet
For MOW Unique Key tables, consider the physical row count of each tablet as well as its compressed data size. Base Compaction builds a rowid conversion map for the physical input rows being merged, with approximately 8 bytes per row for the main mapping storage. Narrow tables or tables with high compression ratios may run out of memory during compaction because of a high row count, even when the tablet size meets the recommendations above. For estimates and mitigation guidance, see Compaction memory overhead on large MOW tablets.
In addition, note the following:
- Choose a bucket count for the compute capacity and expected concurrency of the cluster that runs the workload. Cloud maps tablets to workers separately for each cluster; the bucket count does not have to be an integer multiple of the number of workers. A multiple can align initial tablet counts under modulo-based placement for a fixed worker set, but it does not guarantee equal data volume or query load. Recheck performance after scaling or switching clusters. Colocate tables also need to satisfy their group-specific distribution rules.
- The number of buckets in a single partition should generally not exceed 128. If you need more, partition the table first.
Example bucket counts
The following table gives illustrative starting points. Choose a count based on measured tablet sizes and workload performance for the cluster that runs the workload. These examples do not define a Cloud service limit or guarantee even worker utilization:
| Compressed Partition Data Size | Recommended Number of Buckets |
|---|---|
| < 1 GB | 1 bucket |
| 1 - 10 GB | 10 buckets |
| 10 - 200 GB | 10 - 20 buckets |
| > 200 GB | Partition the table first |
Tip:
Use
SHOW DATAto inspect reported table sizes. Interpret the size and replica fields for your warehouse version. Do not assume that dividing by a replica count gives shared object-storage usage.
2. Set the bucket count automatically
The automatic bucket inference feature predicts future partition sizes based on the partition sizes over a recent period and determines the number of buckets accordingly.
-- Set hash bucket auto
DISTRIBUTED BY HASH(region) BUCKETS AUTO
properties("estimate_partition_size" = "20G")
-- Set random bucket auto
DISTRIBUTED BY RANDOM BUCKETS AUTO
properties("estimate_partition_size" = "20G")
The estimate_partition_size property is used to adjust the initial estimate of the partition size:
- This parameter is optional. If not specified, the default value is
10GB. - This parameter only affects the initial estimate and is independent of the future partition size that the system later infers from historical partition data.
The FE configurations autobucket_min_buckets and autobucket_max_buckets bound the inferred count. These are managed service settings, rather than table properties. The following upstream reference values do not establish the effective configuration of a particular warehouse:
| FE configuration | Default | Description |
|---|---|---|
autobucket_min_buckets | 3 | Lower bound of the auto bucketing result. See the release-specific default change below. |
autobucket_max_buckets | 128 | Upper bound of the auto bucketing result |
Warning:
The VeloDB Core 26.0.6 release notes and VeloDB Core 26.1.3 release notes document an increase in the default
autobucket_min_bucketsvalue from1to3. The higher minimum provides more parallelism and better data distribution for small partitions. A service configuration override can change the minimum.The change affects partitions created after the upgrade. Existing partition bucket counts are unchanged. Ask VeloDB Cloud support to confirm the effective
autobucket_min_bucketssetting. Changing it to1is a service configuration decision, not a warehouse-user step.
4. Maintain data bucketing
Tip:
Currently, the query engine only supports modifying the number of buckets for newly added partitions. The following operations are not supported:
- Modifying the bucketing type is not supported.
- Modifying the bucket key is not supported.
- Modifying the number of buckets for already-created buckets is not supported.
When you create a table, the number of buckets for each partition is uniformly specified through the DISTRIBUTED clause. To handle data growth or shrinkage, you can specify the number of buckets for a new partition individually when dynamically adding partitions.
The following examples show how to modify the number of buckets for newly added partitions through the ALTER TABLE command:
-- Modify hash bucket table
ALTER TABLE demo.hash_bucket_tbl
ADD PARTITION p250103 VALUES LESS THAN("2025-01-03")
DISTRIBUTED BY HASH(region) BUCKETS 16;
-- Modify random bucket table
ALTER TABLE demo.random_bucket_tbl
ADD PARTITION p250103 VALUES LESS THAN("2025-01-03")
DISTRIBUTED BY RANDOM BUCKETS 16;
-- Modify dynamic partition table
ALTER TABLE demo.dynamic_partition_tbl
SET ("dynamic_partition.buckets"="16");
If the client reports a syntax error for SHOW PARTITION, use SHOW PARTITIONS for the table to inspect the bucket count of newly created partitions. Existing partitions keep their previous count.