-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Open
Labels
affects-6.5This bug affects the 6.5.x(LTS) versions.This bug affects the 6.5.x(LTS) versions.planner/cascadesissue/enhance/bug related to yamsissue/enhance/bug related to yamsplanner/join-orderreport/customerCustomers have encountered this bug.Customers have encountered this bug.sig/plannerSIG: PlannerSIG: Plannertype/enhancementThe issue or PR belongs to an enhancement.The issue or PR belongs to an enhancement.
Description
Enhancement
See the case below, the best join order is joining t1 and t2 first, but both our join-order and leading can't support it:
create table t1(id int not null primary key,name varchar(100));
create table t2 like t1;
create table t3 like t1;
create table t4 like t1;
explain select /*+ leading(t1, t2) */ * from t1 inner join t3 on t1.id=t3.id left join t4 on t4.id=t3.id join t2 on t1.id=t2.id where t3.name like 'test3' or t4.name like 'test4';
The root cause is that the predicate t3 like or t4 like splits the whole query into 2 join groups, and both our join-order and leading can't support changing join orders of 2 tables across 2 different join groups:
One solution might be we can pull this predicate up first, and then we can merge these 2 join groups in to 1 and join t1 and t2 first:

Metadata
Metadata
Assignees
Labels
affects-6.5This bug affects the 6.5.x(LTS) versions.This bug affects the 6.5.x(LTS) versions.planner/cascadesissue/enhance/bug related to yamsissue/enhance/bug related to yamsplanner/join-orderreport/customerCustomers have encountered this bug.Customers have encountered this bug.sig/plannerSIG: PlannerSIG: Plannertype/enhancementThe issue or PR belongs to an enhancement.The issue or PR belongs to an enhancement.