pingcap / tidb

TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://www.pingcap.com/tidb-serverless/
https://pingcap.com
Apache License 2.0
36.88k stars 5.8k forks source link

refine range representation on the result of `explain` #8588

Closed zz-jason closed 4 years ago

zz-jason commented 5 years ago

Feature Request

At present, the range representation is a little confusing:

TiDB(root@127.0.0.1:test) > explain select * from t use index(idx);
+-------------------+-------+------+---------------------------------------------------------------------+
| id                | count | task | operator info                                                       |
+-------------------+-------+------+---------------------------------------------------------------------+
| IndexReader_5     | 2.00  | root | index:IndexScan_4                                                   |
| └─IndexScan_4     | 2.00  | cop  | table:t, index:a, range:[NULL,+inf], keep order:false, stats:pseudo |
+-------------------+-------+------+---------------------------------------------------------------------+
2 rows in set (0.00 sec)

TiDB(root@127.0.0.1:test) > explain select * from t use index(idx) where a is not null;
+-------------------+-------+------+---------------------------------------------------------------------+
| id                | count | task | operator info                                                       |
+-------------------+-------+------+---------------------------------------------------------------------+
| IndexReader_6     | 2.00  | root | index:IndexScan_5                                                   |
| └─IndexScan_5     | 2.00  | cop  | table:t, index:a, range:[-inf,+inf], keep order:false, stats:pseudo |
+-------------------+-------+------+---------------------------------------------------------------------+
2 rows in set (0.00 sec)

as you can see in the above:

Describe the feature you'd like:

Can we regard NULL as the smallest value:

Describe alternatives you've considered:

No

Teachability, Documentation, Adoption, Migration Strategy:

No

zz-jason commented 4 years ago

It's the same issue with https://github.com/pingcap/tidb/issues/9231. For the same reason https://github.com/pingcap/tidb/issues/9231#issuecomment-600094541, I'm going to close it as well.