Jacopo Gobbi
07/02/2026, 10:29 AMRocky
07/02/2026, 10:29 AMBUCKETS count, StarRocks determines the bucket count per partition dynamically. Even if it happens to pick the same number as your group (e.g., 32), it is considered "dynamic" and may not satisfy the "static" requirement of the CG until forced.
2. Legacy Partitions: If you have an existing table where some partitions were created with a different bucket count (or even a different internal version of the bucket mapping) before you standardized the table's properties, the table as a whole cannot join the group.
3. Metadata Sync: In some versions, the Frontend (FE) check for colocation is very strict. It doesn't just check the PROPERTIES of the table; it validates the BucketNum of every physical partition.
The Workaround is the "Official" Fix
Running ALTER TABLE ... DISTRIBUTED BY HASH(...) BUCKETS N is the standard way to fix this. This is because:
* It triggers a re-bucketing operation (a background task that redistributes data).
* It ensures that all existing partitions are normalized to the exact same bucket count and distribution schema.
* Once the background job completes, the table's metadata is updated to a "stable" state that the Colocation Group validation can accept.
Recommendations
* Check Partitions: You can verify if there is a discrepancy by running:
sql
SHOW PARTITIONS FROM your_table_name;
Look at the Buckets column for every partition. If even one differs from the others or from the group, the addition will fail.
* Explicit Creation: To avoid this for new tables, always specify the colocate_with property at CREATE TABLE time. This forces StarRocks to validate and fix the distribution immediately upon creation.
* Check Group Status: After adding tables, monitor the group's health:
sql
SHOW PROC '/colocation_group';
If you find that SHOW PARTITIONS confirms all buckets are identical but the error persists until you run the ALTER command, it is likely a metadata synchronization edge case in the FE. For more details on your specific StarRocks version, you can check the StarRocks Colocate Join documentation.
References
• using_starrocks/Colocate_join.md
• best_practices/bucketing.md
• faq/Sql_faq.md