Skip to content
New issue

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

zero estimation result with tidb_enable_inl_join_inner_multi_pattern #58619

Open
hawkingrei opened this issue Dec 30, 2024 · 0 comments · May be fixed by #58623
Open

zero estimation result with tidb_enable_inl_join_inner_multi_pattern #58619

hawkingrei opened this issue Dec 30, 2024 · 0 comments · May be fixed by #58623

Comments

@hawkingrei
Copy link
Member

hawkingrei commented Dec 30, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

set sql_mode = 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';
set @@session.tidb_enable_inl_join_inner_multi_pattern='ON'
create table tbl_4 ( col_16 text ( 315 ) collate utf8_general_ci ,col_17 set ( 'Alice','Bob','Charlie','David' ) , unique key idx_5 ( col_16 ( 5 ) ,col_17 ) ) ;
create table tbl_10 ( col_52 text ( 73 ) collate gbk_bin  not null ) ;
explain format = 'brief' select /*+ inl_join( tbl_4 , tbl_10 ) */ min( distinct  tbl_4.col_17 ) as r0 , elt(2, tbl_10.col_52 , tbl_10.col_52 ) as r1 from tbl_4 right join tbl_10 on tbl_4.col_16 = tbl_10.col_52 where not( tbl_4.col_17 != 'Bob' ) and tbl_4.col_16 between 'EmWPH5cZQK' and null  order by r0,r1 limit 32;

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

without zero estimation

3. What did you see instead (Required)

id	estRows	task	access object	operator info
Projection	1.00	root		Column#6, elt(2, inlj_inner_multi_pattern.tbl_10.col_52, inlj_inner_multi_pattern.tbl_10.col_52)->Column#7
└─Projection	1.00	root		Column#6, inlj_inner_multi_pattern.tbl_10.col_52
  └─TopN	1.00	root		Column#6, Column#12, offset:0, count:32
    └─Projection	1.00	root		Column#6, inlj_inner_multi_pattern.tbl_10.col_52, elt(2, inlj_inner_multi_pattern.tbl_10.col_52, inlj_inner_multi_pattern.tbl_10.col_52)->Column#12
      └─StreamAgg	1.00	root		funcs:min(distinct inlj_inner_multi_pattern.tbl_4.col_17)->Column#6, funcs:firstrow(inlj_inner_multi_pattern.tbl_10.col_52)->inlj_inner_multi_pattern.tbl_10.col_52
        └─IndexJoin	0.00	root		inner join, inner:Selection, outer key:inlj_inner_multi_pattern.tbl_10.col_52, inner key:inlj_inner_multi_pattern.tbl_4.col_16, equal cond:eq(inlj_inner_multi_pattern.tbl_10.col_52, inlj_inner_multi_pattern.tbl_4.col_16)
          ├─TableReader(Build)	10000.00	root		data:TableFullScan
          │ └─TableFullScan	10000.00	cop[tikv]	table:tbl_10	keep order:false, stats:pseudo
          └─Selection(Probe)	0.00	root		not(ne(inlj_inner_multi_pattern.tbl_4.col_17, "Bob"))
            └─IndexLookUp	0.00	root		
              ├─Selection(Build)	0.00	cop[tikv]		not(isnull(inlj_inner_multi_pattern.tbl_4.col_16))
              │ └─IndexRangeScan	0.00	cop[tikv]	table:tbl_4, index:idx_5(col_16, col_17)	range: decided by [eq(inlj_inner_multi_pattern.tbl_4.col_16, inlj_inner_multi_pattern.tbl_10.col_52)], keep order:false, stats:pseudo
              └─Selection(Probe)	0.00	cop[tikv]		ge(inlj_inner_multi_pattern.tbl_4.col_16, "EmWPH5cZQK"), le(inlj_inner_multi_pattern.tbl_4.col_16, NULL)
                └─TableRowIDScan	0.00	cop[tikv]	table:tbl_4	keep order:false, stats:pseudo

4. What is your TiDB version? (Required)

42d4fae

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants