Details
Description
The equality predicate produces notes about unusable keys as expected:
CREATE OR REPLACE TABLE t1 ( |
c1 varchar(10), |
KEY(c1) |
) CHARACTER SET latin1; |
INSERT INTO t1 VALUES ('a'); |
INSERT INTO t1 VALUES ('b'); |
INSERT INTO t1 VALUES ('c'); |
INSERT INTO t1 VALUES ('d'); |
INSERT INTO t1 VALUES ('e'); |
INSERT INTO t1 VALUES ('f'); |
INSERT INTO t1 VALUES ('g'); |
INSERT INTO t1 VALUES ('h'); |
INSERT INTO t1 VALUES ('i'); |
INSERT INTO t1 VALUES ('j'); |
SET note_verbosity=all; |
EXPLAIN SELECT * FROM t1 WHERE c1=10; |
SHOW WARNINGS;
|
+-------+------+-------------------------------------------------------------------------------------------------+
|
| Level | Code | Message |
|
+-------+------+-------------------------------------------------------------------------------------------------+
|
| Note | 1105 | Cannot use key `c1` part[0] for lookup: `test`.`t1`.`c1` of type `varchar` = "10" of type `int` |
|
+-------+------+-------------------------------------------------------------------------------------------------+
|
But these predicates do not produce notes:
EXPLAIN SELECT * FROM t1 WHERE c1<10; |
|
EXPLAIN SELECT * FROM t1 WHERE c1 BETWEEN 10 AND 11; |
|
EXPLAIN SELECT * FROM t1 WHERE c1 IN (_latin1'a' COLLATE latin1_german2_ci,'b'); |
Attachments
Issue Links
- relates to
-
MDEV-32203 Raise notes when an index cannot be used on data type mismatch
-
- Closed
-
-
MDEV-32957 Unusable key notes report wrong predicates for > and >=
-
- Closed
-
-
MDEV-34600 Wrong unusable key column on char_col BETWEEN 'a' AND 3
-
- Open
-
-
MDEV-34601 Unusable key notes do not get reported for IN on data types mismatch
-
- Open
-
Activity
Field | Original Value | New Value |
---|---|---|
Priority | Major [ 3 ] | Critical [ 2 ] |
Link |
This issue relates to |
Link |
This issue relates to |
Description |
The equality predicate produces notes about unusable keys as expected:
{code:sql} CREATE OR REPLACE TABLE t1 ( c1 varchar(10), KEY(c1) ) CHARACTER SET latin1; INSERT INTO t1 VALUES ('a'); INSERT INTO t1 VALUES ('b'); INSERT INTO t1 VALUES ('c'); INSERT INTO t1 VALUES ('d'); INSERT INTO t1 VALUES ('e'); INSERT INTO t1 VALUES ('f'); INSERT INTO t1 VALUES ('g'); INSERT INTO t1 VALUES ('h'); INSERT INTO t1 VALUES ('i'); INSERT INTO t1 VALUES ('j'); SET notes_verbosity=all; EXPLAIN SELECT * FROM t1 WHERE c1=10; SHOW WARNINGS; {code} {noformat} +-------+------+-------------------------------------------------------------------------------------------------+ | Level | Code | Message | +-------+------+-------------------------------------------------------------------------------------------------+ | Note | 1105 | Cannot use key `c1` part[0] for lookup: `test`.`t1`.`c1` of type `varchar` = "10" of type `int` | +-------+------+-------------------------------------------------------------------------------------------------+ {noformat} But these predicates do not produce notes: {code:sql} EXPLAIN SELECT * FROM t1 WHERE c1<10; EXPLAIN SELECT * FROM t1 WHERE c1 BETWEEN 10 AND 11; EXPLAIN SELECT * FROM t1 WHERE c1 IN (_latin1'a' COLLATE latin1_german2_ci,'b'); {code} |
The equality predicate produces notes about unusable keys as expected:
{code:sql} CREATE OR REPLACE TABLE t1 ( c1 varchar(10), KEY(c1) ) CHARACTER SET latin1; INSERT INTO t1 VALUES ('a'); INSERT INTO t1 VALUES ('b'); INSERT INTO t1 VALUES ('c'); INSERT INTO t1 VALUES ('d'); INSERT INTO t1 VALUES ('e'); INSERT INTO t1 VALUES ('f'); INSERT INTO t1 VALUES ('g'); INSERT INTO t1 VALUES ('h'); INSERT INTO t1 VALUES ('i'); INSERT INTO t1 VALUES ('j'); SET note_verbosity=all; EXPLAIN SELECT * FROM t1 WHERE c1=10; SHOW WARNINGS; {code} {noformat} +-------+------+-------------------------------------------------------------------------------------------------+ | Level | Code | Message | +-------+------+-------------------------------------------------------------------------------------------------+ | Note | 1105 | Cannot use key `c1` part[0] for lookup: `test`.`t1`.`c1` of type `varchar` = "10" of type `int` | +-------+------+-------------------------------------------------------------------------------------------------+ {noformat} But these predicates do not produce notes: {code:sql} EXPLAIN SELECT * FROM t1 WHERE c1<10; EXPLAIN SELECT * FROM t1 WHERE c1 BETWEEN 10 AND 11; EXPLAIN SELECT * FROM t1 WHERE c1 IN (_latin1'a' COLLATE latin1_german2_ci,'b'); {code} |
Status | Open [ 1 ] | Confirmed [ 10101 ] |
Assignee | Alexander Barkov [ bar ] |
Assignee | Alexander Barkov [ bar ] | Michael Widenius [ monty ] |
Status | Confirmed [ 10101 ] | In Review [ 10002 ] |
Assignee | Michael Widenius [ monty ] | Alexander Barkov [ bar ] |
Status | In Review [ 10002 ] | Stalled [ 10000 ] |
Fix Version/s | 10.6.17 [ 29518 ] | |
Fix Version/s | 10.11.7 [ 29519 ] | |
Fix Version/s | 11.0.5 [ 29520 ] | |
Fix Version/s | 11.1.4 [ 29024 ] | |
Fix Version/s | 11.2.3 [ 29521 ] | |
Fix Version/s | 11.3.2 [ 29522 ] | |
Fix Version/s | 11.4.1 [ 29523 ] | |
Fix Version/s | 10.6 [ 24028 ] | |
Fix Version/s | 11.3 [ 28565 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Link | This issue relates to MDEV-34600 [ MDEV-34600 ] |
Link | This issue relates to MDEV-34601 [ MDEV-34601 ] |