system.interfaces.cost_functions module

Abstract cost-function interface for join-order query optimization.

class system.interfaces.cost_functions.CostFunction[source]

Bases: ABC

A cost function used to compute the costs of joining two problems.

abstractmethod estimate_join_costs(left: Problem, right: Problem, cardinality_table: CardinalityTable, plan_table: PlanTable) → int[source]

Computes the costs for the left and right input. :param left: The left problem. :param right: The right problem. :param cardinality_table: The cardinality table to be used. :param plan_table: The plan table for the enumeration. :return: The costs of joining the left and right problems.

abstractmethod estimate_filter_costs(problem: Problem, cardinality_table: CardinalityTable) → int[source]

Computes the costs to filter the problem. :param problem: The problem. :param cardinality_table: The cardinality table to be used. :return: The costs of filtering the problem.