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

EXPLAIN shows ref access, while it should have been eq_ref

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11
    • None
    • Optimizer
    • None

    Description

      I've hit this when doing patch #2 for MDEV-30218:
      https://github.com/MariaDB/server/commit/678f2220cc25b3495f1f16fe2732e49a0cd120f8

      EXPLAIN in subselect2.result shows "ref|filter":

      1	PRIMARY	t3	ref|filter	PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX	FFOLDERID_IDX|CMFLDRPARNT_IDX	34|35	test.t3.PARENTID	1 (29%)	Using where; Using rowid filter
      

      The nature of the patch hints that this access should have been eq_ref.
      MDEV-30218.

      Debugging, one can see that best_access_path() considers eq_ref on that index.
      Optimizer Trace also shows:

                    {
                      "access_type": "eq_ref",
                      "index": "FFOLDERID_IDX",
                      "rowid_filter_key": "CMFLDRPARNT_IDX",
                      "rows": 1,
                      "cost": 15.444,
                      "chosen": true
                    },
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            psergei Sergei Petrunia
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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