There’s no easy way. You could modify ‘buildCheapestPlan()’ to build all plans 
below a cost limit. (You’d have to carefully choose a cost limit only a little 
above the optimal cost, otherwise you’ll get huge numbers of plans.)

I fear that you’ll get plans that are different in only trivial or minor 
respects (e.g. ordering of items in a Project) whereas you probably want plans 
with significant differences (e.g. different join orders).

Julian

> On Mar 18, 2020, at 12:01 PM, Rui Souto <[email protected]> wrote:
> 
> Hi there!
> 
> Just recently started to learn about Apache Calcite. What's the best way to
> get a list of the k-cheapest alternative plans generated by the optimizer
> for a given query? (being k an arbitrary number)

Reply via email to