rpsql
A simple heuristic SQL query planner. Can optionally output in a format executable by pythia.
For example:
SELECT
O.ZIP,
COUNT(P.COST)
FROM
(SELECT L.OKEY AS LKEY FROM LINEITEM L) L,
PART P,
ORDERS O
WHERE
L.LKEY = P.PKEY AND
L.LKEY = O.OKEY AND
O.ZIP <> 3800
GROUP BY O.ZIP
ORDER BY COUNT(P.COST) DESC
LIMIT 20;
Creates this plan:
SortLimit (order_by=[Count(P.COST)], limit=20)
AggGroup (grouping=[O.ZIP], agg_field=Count(P.COST))
HashJoin (P.PKEY == L.LKEY)
(build)>Scan (table=PART, file=part.tbl)
(probe)>HashJoin (L.LKEY == O.OKEY)
(build)>Projection ([L.OKEY])
Scan (table=LINEITEM, file=lineitem.tbl.bz2)
(probe)>Filter (O.ZIP != 3800)
Scan (table=ORDERS, file=order.tbl.bz2)
SQL Support
- Joins
- Predicates (inequalities against constants)
- Grouping and Aggregation
- Sorting and Limits
- Subqueries
- Projection