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

Optimizer trace: multi-component range is not printed correctly

    XMLWordPrintable

    Details

      Description

      create table t2 (kp1 int, kp2 int, key(kp1, kp2));
      insert into t2 values (1,1),(1,5),(5,1),(5,5);
      set optimizer_trace=1;
      select * from t2 force index(kp1) where (kp1=2 and kp2 >=4);
      

      select * from information_schema.optimizer_trace;
      

      shows

            "range_scan_alternatives": [
              {
                "index": "kp1",
                "ranges": ["(2,3) <= (kp1,kp2)"],
                "rowid_ordered": false,
                "using_mrr": false,
                "index_only": false,
                "rows": 10,  
                "cost": 58.75,
                "chosen": true
              }
            ],
      

      This is clearly incorrect as kp1=2 allows the range to have an upper bound too.

        Attachments

          Activity

            People

            Assignee:
            psergey Sergei Petrunia
            Reporter:
            psergey Sergei Petrunia
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: