pub fn recommend(
health: &TableHealth,
threshold_vacuum: f64,
threshold_partition_rows: i64,
) -> RecommendationExpand description
Pure recommendation function for a single table.
§Determinism
recommend takes only the borrowed TableHealth and two scalar
thresholds. It performs no I/O, reads no globals, allocates only
the String inside PartitionRecommended::reason (when that arm
fires), and traverses no unordered collections. Repeated invocation
on byte-identical inputs returns byte-identical outputs — the
recommend_is_deterministic test asserts this with 100 repetitions.
§Threshold semantics
threshold_vacuum: dead-tuple ratio strictly above whichRecommendation::VacuumNeededfires. Typical:0.2(20% bloat). Higher values mean the operator tolerates more bloat before flagging.threshold_partition_rows: live row count strictly above which an unpartitioned table triggersRecommendation::PartitionRecommended. Typical:10_000_000. The same threshold is reused for the per-partition row average that drivesRecommendation::PartitionCountIncrease.
§Edge cases
- Empty table (
n_live_tup == 0 && n_dead_tup == 0): vacuum check is short-circuited (division-by-zero guard). Partition checks still run but neither fires for an empty table. partition_count == 0: treated as “not partitioned” — only thePartitionRecommendedrule can fire.partition_count >= 1but row count below threshold: falls through toHealthy.
§See also
Recommendation for the precedence ordering.