system.query_optimization.utils module¶
Utilities to randomize cardinalities and run and visualize join-plan enumeration.
- system.query_optimization.utils.randomize_cardinalities(cardinalities: CardinalityTable, number_of_relations: int, seed: int)[source]¶
Randomizes the problem sizes for the given number of relation. :param cardinalities: The dictionary to store the sizes. :param number_of_relations: The number of singleton problems to be considered. :param seed: The seed for the random cardinalities.
- system.query_optimization.utils.randomize_cardinalities_and_enumerate_join_graph(join_graph: JoinGraph, plan_enumerator: PlanEnumerator, print_info: bool = False) tuple[int, tuple, int][source]¶
Create an example graph and prints its best plan. :param join_graph: The join_graph to use. :param plan_enumerator: The Plan enumerator to be used. :param print_info: A flag to indicate whether to print additional information during enumeration. :return: A tuple, consisting of the costs of the best plan, the best plan as a tuple and the number of csg-cmp pairs that were enumerated.
- system.query_optimization.utils.print_results(results: tuple[int, tuple, int])[source]¶
Print a human-readable summary of an enumeration result. :param results: A tuple of the best plan’s costs, the best plan, and the number of enumerated csg-cmp pairs.
- system.query_optimization.utils.visualize_join_plan(join_plan: tuple | int) str[source]¶
Render a join plan as a nested string using the join symbol. :param join_plan: The join plan, either a relation id (int leaf) or a nested (left, right) tuple. :return: The string representation of the join plan.