We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please answer these questions before submitting your issue. Thanks!
MySQL [test]> create table idxJoinOuter (a int unsigned); Query OK, 0 rows affected (0.12 sec) MySQL [test]> create table idxJoinInner (a int unsigned unique); Query OK, 0 rows affected (0.02 sec) MySQL [test]> explain select /*+ TIDB_INLJ(o, i)*/ * from idxJoinOuter o left join idxJoinInner i on o.a = i.a where o.a in (1, 2) and (i.a - 3) > 0; +--------------------------+----------+------+---------------------------------------------------------------------------+ | id | count | task | operator info | +--------------------------+----------+------+---------------------------------------------------------------------------+ | IndexJoin_10 | 25.00 | root | inner join, inner:IndexReader_9, outer key:o.a, inner key:i.a | | ├─TableReader_13 | 20.00 | root | data:Selection_12 | | │ └─Selection_12 | 20.00 | cop | in(o.a, 1, 2) | | │ └─TableScan_11 | 10000.00 | cop | table:o, range:[-inf,+inf], keep order:false, stats:pseudo | | └─IndexReader_9 | 0.00 | root | index:Selection_8 | | └─Selection_8 | 0.00 | cop | gt(minus(i.a, 3), 0) | | └─IndexScan_7 | 10.00 | cop | table:i, index:a, range: decided by [o.a], keep order:false, stats:pseudo | +--------------------------+----------+------+---------------------------------------------------------------------------+ 7 rows in set (0.00 sec) MySQL [test]> explain select /*+ TIDB_INLJ(o, i)*/ * from idxJoinOuter o left join idxJoinInner i on o.a = i.a where o.a in (1, 2) and i.a in (1,2) and (o.a-3) > 0 and (i.a - 3) > 0; +-------------------------+----------+------+----------------------------------------------------------------------+ | id | count | task | operator info | +-------------------------+----------+------+----------------------------------------------------------------------+ | HashLeftJoin_7 | 20.00 | root | inner join, inner:IndexReader_14, equal:[eq(o.a, i.a)] | | ├─TableReader_11 | 16.00 | root | data:Selection_10 | | │ └─Selection_10 | 16.00 | cop | gt(minus(o.a, 3), 0), in(o.a, 1, 2) | | │ └─TableScan_9 | 10000.00 | cop | table:o, range:[-inf,+inf], keep order:false, stats:pseudo | | └─IndexReader_14 | 16.00 | root | index:Selection_13 | | └─Selection_13 | 16.00 | cop | gt(minus(i.a, 3), 0) | | └─IndexScan_12 | 20.00 | cop | table:i, index:a, range:[1,1], [2,2], keep order:false, stats:pseudo | +-------------------------+----------+------+----------------------------------------------------------------------+ 7 rows in set (0.00 sec)
What did you expect to see? Second query should also choose index join.
What did you see instead? Second query chooses the hash join.
What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)? c625c27
tidb-server -V
select tidb_version();
The text was updated successfully, but these errors were encountered:
winoros
No branches or pull requests
Please answer these questions before submitting your issue. Thanks!
What did you expect to see?
Second query should also choose index join.
What did you see instead?
Second query chooses the hash join.
What version of TiDB are you using (
tidb-server -V
or runselect tidb_version();
on TiDB)?c625c27
The text was updated successfully, but these errors were encountered: