Cost-based query optimizer (WIP).
- Basic algorithm based on Cascades/Columbia papers.
- Basic logical/physical plans.
- Basic implementation/transformation rules.
- Basic physical properties/enforcers.
- Basic cost-model.
- Basic statistics.
- Basic catalog API.
- Basic constraints.
- Ordering.
- Partitioning.
- TODO
- Search space pruning (upper bound/lower bound etc).
- Parameter placeholders/Prepared statements.
- multi-stage optimization setup (logical rewrites -> cost-based -> .. etc.).
- generate plans that can be changed at runtime (configurable access-path selection, etc.).
- Termination: timeout
- Detect cycles in Optimizer::optimize.
- Fallback mechanism to build the remaining physical operators when the optimizer fails to build a logical plan.
- ...
- Select/Filter.
- Projection.
- Scan.
- Join.
- Union/Except/Intersect (ALL).
- Limit/Offset
- Fetch
- VALUES operator.
- Distinct option in SELECT
- TODO
- Basic aggregation functions.
- GROUP BY.
- AGGR(..) FILTER (WHERE _).
- AGGR(DISTINCT _).
- count not null.
- count all.
- Window functions.
- User-defined Aggregate functions.
- GROUPING SET.
- HashAggregate
- StreamingAggregate.
- TODO
- Basic implementation
- ordering within partition
- expressions in PARTITION BY clause
-
Inner
-
Left
-
Right
-
Full
-
Cross
-
Semi
-
Anti (NOT IN ..)
-
Lateral
-
Basic transformation rules: AxB -> BxA, (AxB)xC -> Ax(BxC)
- HashJoin
- MergeSortJoin
- NestedLoopJoin
- TODO
- Basic support.
- Correlated subqueries: EXISTS, IN (cases where an input operator is a restriction(filter/select) or a projection).
- Transform correlated subqueries (EXISTS, IN ) into semi-joins.
- Transform correlated subqueries (NOT EXISTS, NOT IN) into anti-joins.
- Basic scalar expressions.
- Basic aggregate functions.
- Basic sub queries.
- Basic identifiers (
table.column
, etc) - Compound identifiers (
schema.object.whatever
, etc) - Functions expressions.
- IS NULL/IS NOT NULL.
- IN/NOT IN (list).
- IN/NOT IN
<subquery>
. - EXISTS/NOT EXISTS
<subquery>
. - ANY/ALL
<subquery>
. - BETWEEN.
- CASE expression.
- LIKE/NOT LIKE
- Tuples.
- Array access.
- Window functions.
- User-defined aggregate functions.
- TODO
- Basic operators (AND, OR, =, !=, >, <, >=, >=, +, -, /, *, %, ).
- Bitwise operators.
- Basic data type (string, int32, bool).
- Floating point types.
- Decimal types.
- Byte arrays.
- Date (Days)
- Time (Hours, Minutes, Seconds, Millis) without time zone.
- Time with time zone.
- Timestamp without time zone.
- Timestamp with time zone.
- Time intervals: Year, Year to Month, Month, Day, Day to Hour, Day to Minute, Day to Second.
- Arrays.
- Tuples.
- Additional String functions.
- Additional numeric functions.
- Additional date/time functions.
- Additional interval functions.
- Additional array functions.
- Unique.
- Not null.
- Default value.
- Check expression.
- Basic logical rewrites API.
- Predicate push-down.
- Redundant projections removal.
- TODO
- Basic tables.
- Basic indexes.
- Table constraints.
- More index types.
- User-defined functions
- TODO
- row count.
- predicate selectivity.
- TODO
- basic cost model (row count, predicate selectivity).
- compute predicate selectivity.
- TODO
TODO
See test cases in sql/*_tests.yaml
.
-
Basic operators.
-
Basic subqueries.
-
Joins: Inner, Left, Right, Full, Cross
-
SELECT DISTINCT
-
LIMIT/OFFSET
-
FETCH
-
EXPLAIN/ANALYZE
-
ALIAS (column list)
-
AGGREGATE DISTINCT
-
VALUES(..)
-
NOT IN/ IN
<subquery>
-
EXISTS/NOT EXISTS
<subquery>
. -
WITH (Common table expressions)
-
WITH RECURSIVE (Recursive common table expressions)
TODO
TODO