pingcap / pingcap/tidb

analyze predicate column may not get stat info

Open
#56,040 0 comments 0 reactions 1 assignee Claimed by @0xPoe View on GitHub
component/statistics may-affects-5.4 may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 severity/minor sig/planner type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

``` SQL
CREATE TABLE `tlc7a7bc3f` (
`col_32` char(68) COLLATE gbk_bin DEFAULT 'LLQFjN0Ne7',
`col_33` tinyint(1) NOT NULL DEFAULT '1',
`col_34` timestamp NULL DEFAULT NULL,
`col_35` mediumint(8) unsigned NOT NULL DEFAULT '1',
`col_36` binary(79) NOT NULL DEFAULT '3I!s=Kqnf@=7-\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0'
) ENGINE=InnoDB DEFAULT CHARSET=gbk COLLATE=gbk_bin;
CREATE TABLE `tl4f97ac94` (
`col_1` double DEFAULT '8548.501650392927',
`col_2` char(158) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '=I#8%wzce2DpvHr6YZB',
`col_3` float NOT NULL,
`col_4` varbinary(395) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=gbk COLLATE=gbk_chinese_ci;
select /*+ inl_join( tlc7a7bc3f ) */ tlc7a7bc3f.col_32 as r0 from tl4f97ac94 , tlc7a7bc3f where not( tlc7a7bc3f.col_35 in ( 15972450 ,2442965 ,13628873 ,8863316 ,12230202;
) ) order by r0;

dump column usges to mysql.column_stats_usage

analyze table tl4f97ac94 predicate column;

desc select /*+ inl_join( tlc7a7bc3f ) */ tlc7a7bc3f.col_32 as r0 from tl4f97ac94 , tlc7a7bc3f where not( tlc7a7bc3f.col_35 in ( 15972450 ,2442965 ,13628873 ,8863316 ,12230202;
```

### 2. What did you expect to see? (Required)
estRows for tl4f97ac94 is correct.
### 3. What did you see instead (Required)
```
TableFullScan_18 | 10000.00 | cop[tikv] | table:tl4f97ac94
```
### 4. What is your TiDB version? (Required)
master

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.