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

size limited index not used even when query len(data) < len(index)

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Not a Bug
    • 5.5.35-galera
    • None
    • None
    • None

    Description

      When a search is on a 5 character cid, it should be able to use a cid(255) index.

      | CREATE TABLE `cache_data` (
        `cidhash` binary(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0' COMMENT 'Hash of cid - for quick lookups.',
        `cid` varchar(1024) NOT NULL DEFAULT '' COMMENT 'Cache ID.',
        `data` longblob COMMENT 'A collection of data to cache.',
        `expire` int(11) NOT NULL DEFAULT '0' COMMENT 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.',
        `created` int(11) NOT NULL DEFAULT '0' COMMENT 'A Unix timestamp indicating when the cache entry was created.',
        `serialized` smallint(6) NOT NULL DEFAULT '0' COMMENT 'A flag to indicate whether content is serialized (1) or not (0).',
        `tags` longtext COMMENT 'Space-separated list of cache tags for this entry.',
        `checksum_invalidations` int(11) NOT NULL DEFAULT '0' COMMENT 'The tag invalidation sum when this entry was saved.',
        `checksum_deletions` int(11) NOT NULL DEFAULT '0' COMMENT 'The tag deletion sum when this entry was saved.',
        PRIMARY KEY (`cidhash`,`cid`(255)),
        KEY `expire` (`expire`),
        KEY `created` (`created`)
      ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Storage for the cache API.' |

      MariaDB [drupal_dev]> explain extended SELECT cid, data, created, expire, serialized, tags, checksum_invalidations, checksum_deletions FROM cache_data WHERE cidhash = '�D�a?��7���о�U6�' AND cid = 'test1';
      | id   | select_type | table | type | possible_keys | key  | key_len | ref  | rows | filtered | Extra                                               |
      +------+-------------+-------+------+---------------+------+---------+------+------+----------+-----------------------------------------------------+
      |    1 | SIMPLE      | NULL  | NULL | NULL          | NULL | NULL    | NULL | NULL |     NULL | Impossible WHERE noticed after reading const tables |
       

      Attachments

        Activity

          People

            Unassigned Unassigned
            danblack Daniel Black
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.