Skip to content

Join reorder might put the filters to the wrong place #45564

Closed
@winoros

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t(a int);
create table t1(a int, b int);
create table t2(a int, b int, c int);
create table t3(a int, b int);
create table t4(a int, b int);
explain format='brief' select * from t left join t1 on t.a=t1.a inner join t2 on t.a=t2.a and t2.c = 100 left join t3 on t2.a=t3.a and t3.b > 1 left join t4 on t2.a = t4.a where (t2.b > 100 or t.a > 10 or t1.b < 10);

2. What did you expect to see? (Required)

The filter (t2.b > 100 or t.a > 10 or t1.b < 10) should be attached either as an independent selection or to an inner join plan.

3. What did you see instead (Required)

The filter is attached to the outer join node.

4. What is your TiDB version? (Required)

master

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions