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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 5.5, 10.0, 10.1
    • 10.1.7
    • Optimizer
    • 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

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

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.