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
CREATE TABLE `customer` ( `C_CUSTKEY` bigint(20) NOT NULL, `C_NAME` varchar(25) NOT NULL, `C_ADDRESS` varchar(40) NOT NULL, `C_NATIONKEY` bigint(20) NOT NULL, `C_PHONE` char(15) NOT NULL, `C_ACCTBAL` decimal(15,2) NOT NULL, `C_MKTSEGMENT` char(10) NOT NULL, `C_COMMENT` varchar(117) NOT NULL, PRIMARY KEY (`C_CUSTKEY`) /*T![clustered_index] CLUSTERED */ ); CREATE TABLE `nation` ( `N_NATIONKEY` bigint(20) NOT NULL, `N_NAME` char(25) NOT NULL, `N_REGIONKEY` bigint(20) NOT NULL, `N_COMMENT` varchar(152) DEFAULT NULL, PRIMARY KEY (`N_NATIONKEY`) /*T![clustered_index] CLUSTERED */ )
Join should be eliminated
explain select count(*) from customer a left join nation b on a.C_NATIONKEY=b.N_NATIONKEY; +-------------------------------+----------+-----------+---------------+---------------------------------------------------------------------------------+ | id | estRows | task | access object | operator info | +-------------------------------+----------+-----------+---------------+---------------------------------------------------------------------------------+ | HashAgg_8 | 1.00 | root | | funcs:count(1)->Column#13 | | └─HashJoin_19 | 12500.00 | root | | left outer join, equal:[eq(test.customer.c_nationkey, test.nation.n_nationkey)] | | ├─TableReader_24(Build) | 10000.00 | root | | data:TableFullScan_23 | | │ └─TableFullScan_23 | 10000.00 | cop[tikv] | table:b | keep order:false, stats:pseudo | | └─TableReader_22(Probe) | 10000.00 | root | | data:TableFullScan_21 | | └─TableFullScan_21 | 10000.00 | cop[tikv] | table:a | keep order:false, stats:pseudo | +-------------------------------+----------+-----------+---------------+---------------------------------------------------------------------------------+ 6 rows in set (0.00 sec)
master
The text was updated successfully, but these errors were encountered:
planner: remove outer join on unique keys when there is no column ref…
a8bd506
…erenced (#46249) close #46248
Successfully merging a pull request may close this issue.
Bug Report
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
Join should be eliminated
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
master
The text was updated successfully, but these errors were encountered: