Jacopo Gobbi
07/02/2026, 9:08 AMRocky
07/02/2026, 9:09 AMFact_Sales and Fact_Inventory) that are frequently joined on the same key.
2. The Trade-off: Metadata and System Overhead
If you force a smaller table into a high number of buckets to match a large table, you create many undersized tablets (e.g., tablets < 100MB). This introduces several costs:
* Metadata Pressure: Every tablet and its replicas are tracked by the FrontEnd (FE) and BackEnd (BE). Having millions of tablets in a cluster can slow down FE metadata loading, query planning, and BE startup.
* Compaction Overhead: Each tablet has its own compaction tasks. Too many small tablets mean the BE spends significant CPU and I/O just managing many small files across those tablets.
* Resource Fragmentation: Many small tasks across many tablets can lead to less efficient memory and CPU usage compared to fewer, larger tasks.
3. When it is NOT worth it
If the table you are trying to colocate is small (e.g., less than a few hundred MBs or a few GBs depending on cluster size), the "worth it" threshold is usually negative:
* Broadcast Join is better: StarRocks is very efficient at Broadcast Joins. If one table is small, broadcasting it to all nodes is often faster and much "healthier" for the cluster than managing thousands of tiny tablets.
* Bucket Shuffle Join: This is often the best middle ground. If only the large table is bucketed on the join key, StarRocks can shuffle the smaller table's data specifically to the nodes where the large table's buckets reside. This is almost as fast as a Colocate Join but allows the smaller table to have a sane bucket count.
Summary Guidelines
* Aim for Tablet Size: Ideally 1GB to 10GB per tablet.
* Avoid Colocation if: The smaller table ends up with tablets significantly smaller than 100MB, or if the total number of tablets per BE node starts exceeding 20,000–30,000 (as a general rule of thumb for cluster health).
* Use it if: Both tables are large enough that their tablets remain at a reasonable size (e.g., > 500MB) even with the high bucket count.
Recommendation: Use EXPLAIN to see if StarRocks is already choosing a Broadcast or Bucket Shuffle join. If it is, and performance is acceptable, avoid the Colocation Group to keep your metadata footprint small. Only your metadata "fact" tables heavily" tables bucket-aligned.Rocky
07/02/2026, 9:09 AM5 Million tablets:128GB FE RAM recommended. * Alternative (Bucket Shuffle Join): If you don't want the strictness of a Colocation Group, ensure at least one (ideally the larger) table is bucketed by the join key. StarRocks can then perform a Bucket Shuffle Join, which still reduces network traffic significantly without requiring identical bucket counts or a fixed group. Summary If your query performance is bottlenecked by shuffles and your total tablet count (Partitions × Buckets × Replicas) is well under 1 million, the performance gains of Colocation almost always outweigh the metadata overhead of undersized buckets. However, if you have thousands of partitions, be very careful—the multiplier effect can quickly lead to millions of tablets, which will degrade cluster stability. References • faq/Deploy_faq.md • faq/Others.md • faq/shared_data_faq.md • administration/management/monitoring/metrics.md • table_design/data_distribution/Data_distribution.md • knowledge/admin_and_operation/shared_data_compaction.md
Jacopo Gobbi
07/02/2026, 9:13 AMRocky
07/02/2026, 9:13 AMTotal Tablets = Partitions × Buckets × Replicas.
* If you have 100 partitions and 128 buckets with 3 replicas, that's 38,400 tablets. This is well within the limits of a standard cluster (modern BEs can handle 100k–200k tablets comfortably).
* If you have 5,000 partitions, you'd hit 1.92 million tablets, which would significantly strain the FE (Frontend) memory and slow down management operations.
3. When to Choose "Bucket Shuffle Join" Instead
If the colocation requirement (matching 128 buckets) makes your secondary tables too fragmented or makes your schema too rigid, consider Bucket Shuffle Join:
* How it works: You bucket only the large table by the join key. StarRocks will "shuffle" the smaller table's data to the BEs where the large table's buckets already reside.
* Advantage: It still avoids the "Global Shuffle" (network traffic for both tables), but doesn't require the tables to share a Colocation Group or have identical bucket counts.
Summary
* 128 buckets / 500MB is a solid design for a large fact table.
* Worth it? Yes, if the total tablet count for the cluster stays under ~500k. The massive reduction in network latency from Colocate Join will far outweigh the slight metadata overhead of the smaller table's 128 buckets.
References
• table_design/data_distribution/Data_distribution.md
• best_practices/bucketing.md
• using_starrocks/Colocate_join.md
• best_practices/partitioning.md
• faq/operation_maintenance_faq.md
References
• faq/operation_maintenance_faq.md
• knowledge/usage/best-practice.md
• best_practices/partitioning.md
• table_design/data_distribution/Data_distribution.md
• best_practices/query_tuning/schema_tuning.md