Package com.darkcollective.relix.cost
package com.darkcollective.relix.cost
Cost estimation for relix relational algebra trees.
A small, tier-based cost model shared by the query optimizer and the execution engine, so that neither has to depend on the other.
Core types
CostTier— an ordinal cost class (INLINE < VIEW < FILE < REMOTE) describing how expensive a relation is to read.CostEstimator— walks aRelNodetree, resolving leaf relations against aSymbolTable, and returns the dominatingCostTier.
Consumers
- The optimizer uses it to order join inputs (cheaper side first).
- The execution engine uses it to pick the build side of a hash join.
-
ClassDescriptionWhether a relation is guaranteed finite — a logical property propagated bottom-up over a
RelNodetree.Materialisation-safety check: a blocking operator — one that must buffer its whole input before emitting any row — over a provably unbounded input is a plan-time error.Supplies theBoundednessof a leaf relation by name — the one piece of boundedness that is not structural but depends on what the leaf actually is.Estimates the relative I/O cost of aRelNodeexpression by inspecting the types of its leaf relation symbols.Ordinal cost tier for a relation or sub-expression, used byCostEstimatorto rank data sources from cheapest to most expensive.Supplies whether a leaf relation is inherently duplicate-free — the one piece of distinctness that is not structural but depends on what the leaf actually is.Supplies, for a leaf relation, the column on which it is a monotone-ascending unbounded generator — the one fact the optimizer needs to decide that an upper-bound selection (n < k) can be folded into the producer as a termination stop (GEN-001).Row counts a previous run actually produced, keyed by the expression that produced them.Centralised operator-property classification consulted byPropertyDeriver,OrderDeriver,BoundednessChecker, andCostEstimator.DerivesRelationPropertiesfor aRelNodetree bottom-up, purely structurally — from each operator's semantics and its children's properties — with no schema or symbol-table lookup.Logical properties of a relation, derived bottom-up over aRelNodetree and consumed by the optimizer and planner.ADistinctnessSourcethat reads duplicate-freeness off a leaf relation's declared keys — the base-relation half of the seam, complementing the generator-backed source that coversRange/Naturals/Primes.SuppliesRelationStatisticsfor a leaf relation by name, the seam through which theCostEstimatorobtains cardinality metadata.