Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-8613

Full table scan for WHERE indexed_varchar_column <=> 'bad-character'

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.5, 10.0, 10.1
    • Fix Version/s: 10.1.7
    • Component/s: Optimizer
    • Labels:
      None

      Description

      The patch for MDEV-6105 made this script

      SET NAMES utf8;
      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET utf8, KEY(a)) ENGINE=MyISAM;
      INSERT INTO t1 VALUES ('a'),('b'),('c'),('d'),('e');
      EXPLAIN SELECT * FROM t1 WHERE a='��';

      correct;y return "Impossible WHERE":

      +------+-------------+-------+------+---------------+------+---------+------+------+-----------------------------------------------------+
      | id   | select_type | table | type | possible_keys | key  | key_len | ref  | rows | Extra                                               |
      +------+-------------+-------+------+---------------+------+---------+------+------+-----------------------------------------------------+
      |    1 | SIMPLE      | NULL  | NULL | NULL          | NULL | NULL    | NULL | NULL | Impossible WHERE noticed after reading const tables |
      +------+-------------+-------+------+---------------+------+---------+------+------+-----------------------------------------------------+

      However, if I use <=> instead of =, it still switches to full table scan.

      It should be fixed to return "Impossible WHERE" for <=>.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                bar Alexander Barkov
                Reporter:
                bar Alexander Barkov
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: