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

Optimizer trace prints date in hexadecimal

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.4(EOL)
    • 10.4.6
    • Optimizer
    • None

    Description

      create table t1 (start_date date, end_date date, filler char(100), key(start_date, end_date)) ;
      insert into t1 select date_add(now(), interval a day), date_add(now(), interval (a+7) day), 'data' from one_k;
      Query OK, 1000 rows affected, 2000 warnings (0.40 sec)
      Records: 1000  Duplicates: 0  Warnings: 2000
      

      mysql> set optimizer_trace=1;
      mysql> explain format=json select * from t1 force index(start_date) where start_date >= '2019-02-10' and end_date <'2019-04-01';
      | {
        "query_block": {
          "select_id": 1,
          "table": {
            "table_name": "t1",
            "access_type": "range",
            "possible_keys": ["start_date"],
            "key": "start_date",
            "key_length": "8",
            "used_key_parts": ["start_date", "end_date"],
            "rows": 1000,
            "filtered": 100,
            "index_condition": "t1.start_date >= '2019-02-10' and t1.end_date < '2019-04-01'"
          }
        }
      }
      

      In optimizer trace we see

          "range_scan_alternatives": [
            {
              "index": "start_date",
              "ranges": ["0x4ac60f <= start_date"],
              "rowid_ordered": false,
              "using_mrr": false,
              "index_only": false,
              "rows": 1000,
              "cost": 1252.4,
              "chosen": true
            }
          ],
      

      the range on start_date is shown as "ranges": ["0x4ac60f <= start_date"].
      The date should not be printed in hexa decimal value.

      Attachments

        Activity

          varun Varun Gupta (Inactive) created issue -
          varun Varun Gupta (Inactive) made changes -
          Field Original Value New Value
          Description
          {code:sql}
          create table t1 (start_date date, end_date date, filler char(100), key(start_date, end_date)) ;
          insert into t1 select date_add(now(), interval a day), date_add(now(), interval (a+7) day), 'data' from one_k;
          Query OK, 1000 rows affected, 2000 warnings (0.40 sec)
          Records: 1000 Duplicates: 0 Warnings: 2000
          {code}

          {code}
          mysql> set optimizer_trace=1;
          mysql> explain format=json select * from t1 force index(start_date) where start_date >= '2019-02-10' and end_date <'2019-04-01';
          | {
            "query_block": {
              "select_id": 1,
              "table": {
                "table_name": "t1",
                "access_type": "range",
                "possible_keys": ["start_date"],
                "key": "start_date",
                "key_length": "8",
                "used_key_parts": ["start_date", "end_date"],
                "rows": 1000,
                "filtered": 100,
                "index_condition": "t1.start_date >= '2019-02-10' and t1.end_date < '2019-04-01'"
              }
            }
          }
          {code}

          In optimizer trace we see
          {code}
              "range_scan_alternatives": [
                {
                  "index": "start_date",
                  "ranges": ["0x4ac60f <= start_date"],
                  "rowid_ordered": false,
                  "using_mrr": false,
                  "index_only": false,
                  "rows": 1000,
                  "cost": 1252.4,
                  "chosen": true
                }
              ],
          {code}
          the range on start_date is shown as "ranges": ["0x4ac60f <= start_date"].
          The date should not be printed in hexa decimal value.
          varun Varun Gupta (Inactive) made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          varun Varun Gupta (Inactive) made changes -
          Fix Version/s 10.4.6 [ 23412 ]
          Fix Version/s 10.4 [ 22408 ]
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Closed [ 6 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 93103 ] MariaDB v4 [ 155892 ]

          People

            varun Varun Gupta (Inactive)
            varun Varun Gupta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.