Skip to content

partition pruning leads to different partition when utf8mb4_general_ci is set #51316

@jiyfhust

Description

@jiyfhust

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create table t(col varchar(32) COLLATE utf8mb4_general_ci DEFAULT NULL) PARTITION BY KEY (`col`) PARTITIONS 7;
explain select * from t where col = 'linpin';
explain select * from t where col = 'LINPIN';

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

The query above should be pruned to the same partition.

3. What did you see instead (Required)

mysql> explain select * from t where col = 'linpin';
+-------------------------+----------+-----------+-----------------------+--------------------------------+
| id                      | estRows  | task      | access object         | operator info                  |
+-------------------------+----------+-----------+-----------------------+--------------------------------+
| TableReader_8           | 10.00    | root      |                       | data:Selection_7               |
| └─Selection_7           | 10.00    | cop[tikv] |                       | eq(test.t.col, "linpin")       |
|   └─TableFullScan_6     | 10000.00 | cop[tikv] | table:t, partition:p4 | keep order:false, stats:pseudo |
+-------------------------+----------+-----------+-----------------------+--------------------------------+
3 rows in set, 1 warning (0.01 sec)

mysql> explain select * from t where col = 'LINPIN';
+-------------------------+----------+-----------+-----------------------+--------------------------------+
| id                      | estRows  | task      | access object         | operator info                  |
+-------------------------+----------+-----------+-----------------------+--------------------------------+
| TableReader_8           | 10.00    | root      |                       | data:Selection_7               |
| └─Selection_7           | 10.00    | cop[tikv] |                       | eq(test.t.col, "LINPIN")       |
|   └─TableFullScan_6     | 10000.00 | cop[tikv] | table:t, partition:p3 | keep order:false, stats:pseudo |
+-------------------------+----------+-----------+-----------------------+--------------------------------+
3 rows in set, 1 warning (0.00 sec)

partition:p4 and partition:p3, they are not same.

4. What is your TiDB version? (Required)

master

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions