Hello all,

Calcite contains many optimization rules. It is not obvious to me how to 
assemble them into a good planner. Can people recommend tested query planners 
based on Calcite that are open-source and that can be used as a starting point?

In particular, I am having trouble making a HEP-planner produce a good plan for 
Q21 from TPC-H; the planner I assembled produces many cartesian products.

For reference, here is the variant of Q21 that I am using:

create view q21 (
    s_name,
    numwait
) as
select
    s_name,
    count(*) as numwait
from
    supplier,
    lineitem l1,
    orders,
    nation
where
    s_suppkey = l1.l_suppkey
    and o_orderkey = l1.l_orderkey
    and o_orderstatus = 'F'
    and l1.l_receiptdate > l1.l_commitdate
    and exists (
        select
            *
        from
            lineitem l2
        where
            l2.l_orderkey = l1.l_orderkey
            and l2.l_suppkey <> l1.l_suppkey
    )
    and not exists (
        select
            *
        from
            lineitem l3
        where
            l3.l_orderkey = l1.l_orderkey
            and l3.l_suppkey <> l1.l_suppkey
            and l3.l_receiptdate > l3.l_commitdate
    )
    and s_nationkey = n_nationkey
    and n_name = 'GERMANY'
group by
    s_name
order by
    numwait desc,
    s_name
LIMIT 100;

Thank you for any suggestions!
Mihai

Reply via email to