Amit Chaudhari
02/14/2026, 9:05 PMRocky
02/14/2026, 9:05 PMALTER TABLE to modify the bucket count of existing partitions or the entire table to redistribute data.
* The limitation: While StarRocks v3.2+ introduced a feature to modify bucket counts and redistribute data for shared-storage (classic) tables, the documentation explicitly states that shared-data mode currently does not support this feature.
* The workaround: If you must change the bucket count for existing data, you will need to create a new table with the desired bucket count and migrate the data using INSERT INTO ... SELECT.
2. Random Bucketing (Dynamic Growth)
If your shared-data table is configured with Random Bucketing (supported since v3.2), you can influence the bucket count dynamically.
* Dynamic Increase: StarRocks can dynamically increase the number of buckets in a partition during data loading based on the volume of data.
* Modify Property: You can modify the bucket_size property to control this behavior:
sql
ALTER TABLE <table_name> SET ("bucket_size" = "1073741824"); -- Set to 1GB
This allows StarRocks to add new "sub-partitions" (and thus more buckets) as data grows.
3. Future Partitions (New Data)
If you have a partitioned table, you can change the bucket count for new partitions that have not been created yet:
* Manual Partitions: When adding a new partition, you can specify a different bucket count:
sql
ALTER TABLE <table_name> ADD PARTITION <partition_name>
VALUES [...] DISTRIBUTED BY HASH(<column>) BUCKETS <new_count>;
* Dynamic Partitioning: You can update the default bucket count for future partitions created by the dynamic partitioning scheduler:
sql
ALTER TABLE <table_name> SET ("dynamic_partition.buckets" = "<new_count>");
Summary Table for Shared-Data Mode
Feature | Supported?
ALTER TABLE ... BUCKETS (Redistribute existing HASH data) | No
ALTER TABLE ... SET ("bucket_size" = "...") (RANDOM bucketing) | Yes (v3.2+)
Change buckets for new manual partitions | Yes
Change buckets for future dynamic partitions | Yes
Recommendation: For shared-data mode, it is highly recommended to use Automatic Bucketing (by not specifying BUCKETS at creation) or Random Bucketing (with bucket_size) so that StarRocks can manage the distribution for you as your data scales.
References
• knowledge/usage/best-practice.md
• table_design/data_distribution/Data_distribution.md
• sql-reference/sql-statements/table_bucket_part_index/ALTER_TABLE.mdAmit Chaudhari
02/14/2026, 9:49 PMRocky
02/14/2026, 9:49 PMlake_enable_balance_tablets_between_workers: Set to true (default) to allow the FE to automatically rebalance tablet assignments among CN nodes.
* lake_balance_tablets_threshold: The threshold for triggering a rebalance. The default is 0.15. If the imbalance factor (MAX(tablets) - MIN(tablets)) / AVERAGE(tablets) exceeds this, a rebalance is triggered.
If you add or remove CN nodes, the FE will automatically detect the change and redistribute the tablet assignments to ensure the load is balanced.
2. Shared-nothing Clusters
In the classic Shared-nothing architecture:
* BE (Backend) nodes store the physical tablet replicas. Tablet rebalancing happens automatically between BE nodes.
* CN nodes are used for computation only and do not host tablet replicas. Therefore, the concept of "tablet distribution" or "replica rebalancing" does not apply to CN nodes in this mode.
How to check the status
You can check the balance status of your cluster (for BEs) using:
sql
SHOW PROC '/cluster_balance/balance_stat';
And to see pending or running tablet tasks:
sql
SHOW PROC '/cluster_balance/pending_tablets';
SHOW PROC '/cluster_balance/running_tablets';
In summary: If you're on a recent StarRocks 3.x version in shared-data mode, it's handled automatically! If you're using CN nodes for pure compute in shared-nothing mode, they don't hold tablets, so there's nothing to rebalance on them.
Let me know if you need help with specific configurations!
References
• administration/management/resource_management/Replica.md
• administration/management/FE_configuration.md
• administration/management/compaction.md
• using_starrocks/Colocate_join.md
• knowledge/admin_and_operation/shared_data_compaction.mdRocky
02/14/2026, 9:52 PMstarRocksCnSpec (if using the StarRocks Operator), you can specify limits.cpu.
yaml
starRocksCnSpec:
limits:
cpu: 8 # Limit CN to 8 CPU cores
* Cgroups/Docker: You can set CPU quotas using Docker's --cpus flag or direct Linux cgroups to restrict the entire CN process.
2. Workload Isolation (Resource Groups)
Starting from v3.3.5, StarRocks supports CPU hard limits via Resource Groups. This is the best way to ensure specific workloads don't exceed a set amount of CPU.
* Exclusive CPU Cores (Hard Limit): Use the exclusive_cpu_cores parameter. This reserves specific cores for a group and prevents them from using more, even if other cores are idle.
sql
CREATE RESOURCE GROUP my_limit_group
PROPERTIES (
"exclusive_cpu_cores" = "4", -- Hard limit of 4 cores
"mem_limit" = "20%"
);
* Max CPU Cores: You can also set max_cpu_cores to define the maximum number of cores a resource group can use on a single node.
3. Global Thresholds (Query Queues)
You can set a threshold that triggers query queuing when the CN's CPU usage becomes too high. This prevents the node from becoming completely overwhelmed.
* Variable: query_queue_cpu_used_permille_limit
* Example: Setting this to 800 (80%) will cause new queries to wait in a queue if the total CPU usage on the node exceeds 80%.
sql
SET GLOBAL query_queue_cpu_used_permille_limit = 800;
4. Configuration Tuning (CN Level)
In your cn.conf file, you can manually override the number of CPU cores StarRocks detects. This affects the size of internal thread pools (like the pipeline engine):
* Parameter: num_cores
* If you set num_cores = 8 on a 16-core machine, StarRocks will size its thread pools as if it only has 8 cores available.
Summary of Recommendation
* For hard capping the entire CN: Use Kubernetes/Container limits.
* For isolating users/tenants: Use Resource Groups with exclusive_cpu_cores (v3.3.5+).
* To prevent system overload: Use Query Queues with query_queue_cpu_used_permille_limit.
References
• faq/Others.md
• administration/management/BE_configuration.md
• deployment/plan_cluster.mdAmit Chaudhari
02/15/2026, 4:31 AMRocky
02/15/2026, 4:31 AMALTER TABLE statement. This command triggers an internal re-bucketing process.
sql
-- For specific partitions
ALTER TABLE <table_name>
PARTITIONS (<partition_name1>, <partition_name2>)
DISTRIBUTED BY HASH(<bucket_key>) BUCKETS <new_bucket_count>;
-- For all partitions in the table
ALTER TABLE <table_name>
DISTRIBUTED BY HASH(<bucket_key>) BUCKETS <new_bucket_count>;
Method 2: The Manual Way (Temporary Partitions)
If you prefer or need to use the manual temporary partition method, the steps are as follows:
1. Create a temporary partition with the same range as the original partition but with the new bucket count:
sql
ALTER TABLE <table_name>
ADD TEMPORARY PARTITION <temp_partition_name> VALUES [("start_value"), ("end_value"))
DISTRIBUTED BY HASH(<bucket_key>) BUCKETS <new_bucket_count>;
2. Migrate data from the formal partition to the temporary partition:
sql
INSERT INTO <table_name> TEMPORARY PARTITION (<temp_partition_name>)
SELECT * FROM <table_name> PARTITION (<original_partition_name>);
3. Replace the original partition with the temporary one:
sql
ALTER TABLE <table_name>
REPLACE PARTITION (<original_partition_name>)
WITH TEMPORARY PARTITION (<temp_partition_name>);
Important Considerations for Shared-Data Clusters:
* Storage Volume: In shared-data mode, ensure the table is stored in a supported storage volume (S3, OSS, HDFS, etc.).
* Version Support: While temporary partitions have been supported for a long time, the direct ALTER TABLE ... BUCKETS command is significantly easier and was introduced in v3.2.
* Atomic Operation: Both methods ensure that the swap (replacement) is atomic, meaning queries will not see partial data during the process.
* Schema Change: You cannot perform schema changes (like adding columns) while temporary partitions exist on the table.
References
• deployment/shared_data/feature-support-shared-data.md
• faq/resource_isolation_faq.mdAmit Chaudhari
02/15/2026, 4:32 AMRocky
02/15/2026, 4:33 AMRocky
02/16/2026, 12:51 AMALTER TABLE ... DISTRIBUTED BY ... BUCKETS <num> is currently not supported for shared-data mode.
While this feature was introduced in version 3.2 for shared-nothing tables, the official documentation explicitly notes:
NOTICE: StarRocks's shared-data mode currently does not support this feature.Why you see zero rows and errors When you run this command on a shared-data table, the metadata for the partitions can become inconsistent. The "zero rows and zero bytes" symptom suggests that the metadata was updated to reflect new bucketing information, but the actual data was not redistributed in the background (as the feature is unsupported). The
load segments error occurs because the query engine is trying to find segment files in the object storage based on the new, incorrect bucket/tablet metadata, but those files do not exist or are not where the engine expects them to be.
How to Resolve and Recommended Approach
Since the metadata for those partitions is likely corrupted or points to empty sets, you will need to restore or recreate the data.
1. For existing data: The only supported way to change the bucket count for existing data in a shared-data table is to:
* Create a new table with the desired bucketing configuration.
_ Migrate the data using INSERT INTO new_table SELECT _ FROM old_table;. (Note: If the old table is completely unqueryable due to the "load segments error", you may need to restore it from a backup or re-import the data).
2. For future partitions:
If you want newly created partitions to use a different bucket count without affecting existing ones, you can modify the table's default bucket count (supported in v3.2.11+, v3.3.5+, and v3.4.0+):
sql
ALTER TABLE <table_name> MODIFY COLUMN BUCKETS <num>;
-- Or in newer versions (v3.5.8+, v4.0.1+):
ALTER TABLE <table_name> DISTRIBUTED BY HASH(...) DEFAULT BUCKETS <num>;
This only affects partitions created after the command is run.
Recovery Hint
If you need to get the table back to a working state immediately, you can try to ALTER TABLE back to the exact original bucket count and bucketing key. If the metadata reverts correctly, you might be able to access the original segments again, but this is not guaranteed if the metadata state has been significantly altered.
References
• faq/operation_maintenance_faq.md
• table_design/data_distribution/Data_distribution.md
• sql-reference/sql-statements/table_bucket_part_index/ALTER_TABLE.mdAmit Chaudhari
02/16/2026, 12:55 AMRocky
02/16/2026, 12:55 AMBACKUP SNAPSHOT command to save data to a remote repository (like S3, OSS, or MinIO), yes, you can save multiple snapshots.
* Each snapshot must have a unique name within the same database.
* While you can only run one active backup job at a time per database, you can perform multiple backups sequentially and store them in the same repository.
* You can view all saved snapshots in a repository using:
sql
SHOW SNAPSHOT ON repository_name;
2. Cluster Snapshot (Shared-data Architecture)
If you are referring to the Cluster Snapshot feature used for disaster recovery in shared-data clusters:
* Currently, the system is designed to maintain a snapshot that closely follows the latest cluster state.
* Only one cluster snapshot is kept at a time. When a new snapshot is successfully generated, the older historical snapshot is automatically dropped.
3. Data Lake Snapshots (Iceberg/Hudi)
If you are querying external tables like Iceberg or Hudi through StarRocks:
* These table formats inherently support multiple snapshots (time travel). StarRocks allows you to query specific historical snapshots using the FOR SYSTEM_TIME AS OF or FOR SYSTEM_VERSION AS OF syntax, provided those snapshots are still retained in the underlying storage.
Summary:
For general data protection and migration, use BACKUP SNAPSHOT with different names to keep multiple point-in-time copies of your data!
Let me know if you need the specific syntax for any of these!
References
• faq/Exporting_faq.md
• administration/management/Backup_and_restore.md
• sql-reference/sql-statements/backup_restore/BACKUP.md
• administration/cluster_snapshot.mdRocky
02/16/2026, 1:04 AMRowCount and DataSize metrics shown in SHOW PARTITIONS or information_schema.partitions are often estimates that are updated asynchronously.
* The Compaction Link: In shared-data mode, physical data statistics are often recalculated and pushed to the FE's metadata during compaction. If compaction has not been run in a long time (as you noted), the metadata might not have been refreshed with the latest consolidated stats from the object storage.
* Asynchronous Updates: For Primary Key tables, the system prioritizes "Delete+Insert" logic. The actual "visible" row count is finalized when the BEs apply the delete vectors and report the results back to the FE. In some versions, this reporting only happens periodically or during compaction events.
2. Lack of Compaction in Shared-Data
In a shared-data cluster, compaction is scheduled by the FE and performed by the Compute Nodes (CNs).
* If compaction is disabled or stuck, the "Visible Version" of the partition will keep increasing, but the FE's cached statistics for that partition may remain at 0 until a successful compaction task consolidates the versions and calculates the new size/count.
* You can check the compaction status and score for that partition using:
sql
-- Replace with your DB and Table name
SHOW PROC '/dbs/<db_id>/<table_id>/partitions';
Look for the MaxCS (Max Compaction Score). If it is very high, it confirms that compaction is lagging.
3. Metadata Refresh Lag
The SHOW PARTITIONS command retrieves data from the FE's memory. In a shared-data architecture, if the FE has not received a status update from the CNs (which normally happens after load or compaction), it will show the last known state (which might be the initial 0 state).
How to verify if data actually exists:
Do not rely solely on SHOW PARTITIONS for data validation. Instead, run a direct query to see if the data is accessible:
sql
SELECT COUNT(*) FROM your_table PARTITION (your_partition_name);
If this query returns the correct number of rows, then the issue is purely a metadata display issue in the FE, likely caused by the lack of compaction you mentioned.
Recommended Actions:
1. Check Compaction Status: Run SHOW COMPACTION to see if there are any active or failed compaction tasks.
2. Trigger Manual Compaction: If the compaction score is high and it hasn't run, you can try to trigger it manually to force a metadata update.
3. Check FE Logs: Look for InternalTableStats or "report" related logs in the FE to see if it's having trouble updating table statistics.
4. Use `partitions_meta`: If you are on version 3.1.9+ or 3.2.4+, check the information_schema.partitions_meta table for a more detailed view of the partition metadata.
sql
SELECT * FROM information_schema.partitions_meta
WHERE TABLE_NAME = 'your_table' AND PARTITION_NAME = 'your_partition';
If the row count is critical for your operations (like for the query optimizer), running ANALYZE TABLE <table_name> can sometimes help force a recalculation of statistics.
References
• knowledge/admin_and_operation/shared_data_compaction.md