In most cases increasing the number of traits from one to two will increase the planning time by a negligible amount.
But it can increase the size of the search space. Suppose a particular relational expression has 5 possible sort orders (order by x, order by x, y, order by (), order by z, order by x, z), and initially you have only the collation trait enabled. A particular equivalence set might have 5 subsets, one for each sort order. Now let’s suppose you add the distribution trait to the mix, and there are 3 distributions (partition by (), partition by x, partition by z). Now that subset will have 15 subsets, for the cartesian product of the traits. A larger search space could increase the planning time (and memory usage) significantly. But if each trait has only one or two values I doubt that there will be a problem. Julian > On Jan 14, 2019, at 1:38 AM, Hequn Cheng <[email protected]> wrote: > > Hi everyone, > > I want to pass properties through RelNodes via trait and I wonder if the > number of traits in traitSet will affect the time of Volcano optimization. > For example, increasing one traitDef to two in VolcanoPlanner. > > I guess the answer is No. Is it correct? > As long as the search space is not increased, the Volcano optimization time > will not increase. And simply increasing the number of traits alone does > not add complexity. > > Furthermore, besides time, are there any other side effects if I increase > the number of traits? > > Thank you very much! > > Best, > Hequn
