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

Query runs slower using a UNIQUE KEY vs. a KEY

    XMLWordPrintable

Details

    Description

      I have an old Request Tracker 3.6 setup using MariaDB 10.2.10 (recently rebuilt, was on MySQL 5.5 before and did not have this issue). I noticed that a query that includes searching by the requester Name is much slower than searching by the EmailAddress. When I look at the SQL query generated, the only difference is searching by the Users.Name column vs. the Users.EmailAddress column. The Name column is a UNIQUE KEY while the EmailAddress column is just a KEY (each of the keys has just the one column). That doesn't seem like it should cause a big difference.

      I'm attaching the Users table schema as well as "explain extended" of the two queries.

      Attachments

        1. explain-email.txt
          3 kB
          Chris Adams
        2. explain-name.txt
          3 kB
          Chris Adams
        3. tables.sql
          2 kB
          Chris Adams
        4. Users.sql
          1 kB
          Chris Adams

        Issue Links

          Activity

            People

              alice Alice Sherepa
              cmadams Chris Adams
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.