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 a RelNode tree, resolving leaf relations against a SymbolTable, and returns the dominating CostTier.

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.
  • Class
    Description
    Whether a relation is guaranteed finite — a logical property propagated bottom-up over a RelNode tree.
    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 the Boundedness of 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 a RelNode expression by inspecting the types of its leaf relation symbols.
    Ordinal cost tier for a relation or sub-expression, used by CostEstimator to 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 by PropertyDeriver, OrderDeriver, BoundednessChecker, and CostEstimator.
    Derives the Ordering a RelNode sub-tree is guaranteed to deliver, bottom-up and purely structurally.
    Derives RelationProperties for a RelNode tree 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 a RelNode tree and consumed by the optimizer and planner.
    A DistinctnessSource that reads duplicate-freeness off a leaf relation's declared keys — the base-relation half of the seam, complementing the generator-backed source that covers Range/Naturals/Primes.
    Supplies RelationStatistics for a leaf relation by name, the seam through which the CostEstimator obtains cardinality metadata.