Skip to main content

recommend

Function recommend 

Source
pub fn recommend(
    health: &TableHealth,
    threshold_vacuum: f64,
    threshold_partition_rows: i64,
) -> Recommendation
Expand 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

§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 the PartitionRecommended rule can fire.
  • partition_count >= 1 but row count below threshold: falls through to Healthy.

§See also

Recommendation for the precedence ordering.