-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
affects-6.1This bug affects the 6.1.x(LTS) versions.This bug affects the 6.1.x(LTS) versions.affects-6.5This bug affects the 6.5.x(LTS) versions.This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.This bug affects the 7.5.x(LTS) versions.found/gsfound by gsfound by gsreport/customerCustomers have encountered this bug.Customers have encountered this bug.sig/plannerSIG: PlannerSIG: Plannertype/enhancementThe issue or PR belongs to an enhancement.The issue or PR belongs to an enhancement.
Description
Bug Report
After pr 31278 , we can't use like
to build range when new collation is enabled. This doesn't make sense and will cause bad sql performance.
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
CREATE TABLE `t1` (
`id` varchar(40) COLLATE utf8mb4_general_ci NOT NULL,
`name` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL,
`password` varchar(100) COLLATE utf8mb4_general_ci DEFAULT NULL,
KEY `ix_name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
2. What did you expect to see? (Required)
mysql> explain SELECT * FROM t1 cm use index(ix_name) WHERE cm.name LIKE '18620391343%';
+-------------------------------+---------+-----------+--------------------------------------------------------+---------------------------------------------------------------------+
| id | estRows | task | access object | operator info |
+-------------------------------+---------+-----------+--------------------------------------------------------+---------------------------------------------------------------------+
| IndexLookUp_7 | 250.00 | root | | |
| ├─IndexRangeScan_5(Build) | 250.00 | cop[tikv] | table:cm, index:ix_name(name) | range:["18620391343","18620391344"), keep order:false, stats:pseudo |
| └─TableRowIDScan_6(Probe) | 250.00 | cop[tikv] | table:cm | keep order:false, stats:pseudo |
+-------------------------------+---------+-----------+--------------------------------------------------------+---------------------------------------------------------------------+
3 rows in set (0.01 sec)
3. What did you see instead (Required)
mysql> explain SELECT * FROM t1 cm use index(ix_name) WHERE cm.name LIKE '18620391343%';
+-------------------------------+----------+-----------+--------------------------------------------------------+---------------------------------------------------------+
| id | estRows | task | access object | operator info |
+-------------------------------+----------+-----------+--------------------------------------------------------+---------------------------------------------------------+
| IndexLookUp_8 | 8000.00 | root | | |
| ├─Selection_7(Build) | 8000.00 | cop[tikv] | | like(test.company_member.logonname, "18620391343%", 92) |
| │ └─IndexFullScan_5 | 10000.00 | cop[tikv] | table:cm, index:ix_name(name) | keep order:false, stats:pseudo |
| └─TableRowIDScan_6(Probe) | 8000.00 | cop[tikv] | table:cm | keep order:false, stats:pseudo |
+-------------------------------+----------+-----------+--------------------------------------------------------+---------------------------------------------------------+
4 rows in set (0.01 sec)
4. What is your TiDB version? (Required)
v6.5.3
Metadata
Metadata
Assignees
Labels
affects-6.1This bug affects the 6.1.x(LTS) versions.This bug affects the 6.1.x(LTS) versions.affects-6.5This bug affects the 6.5.x(LTS) versions.This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.This bug affects the 7.5.x(LTS) versions.found/gsfound by gsfound by gsreport/customerCustomers have encountered this bug.Customers have encountered this bug.sig/plannerSIG: PlannerSIG: Plannertype/enhancementThe issue or PR belongs to an enhancement.The issue or PR belongs to an enhancement.