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

Improve selectivity and related costs in optimizer

Details

    Description

      There is a cleanup task for several things in the optimizer.

      • Ensure that 0 <= selectivity <= 1
      • Ensure that selectivity calculation doesn't return too few row
      • Calculate and use index only cost when appropriate.
      • Examine and improve cost calculation in the optimizer for:
      • filters
      • Ensure that filter cost calculation also include index only cost and compare with WHERE
      • ranges
      • table scans
      • hash and joins and cached full joins
      • group by
      • Adjusted Range_rowid_filter_cost_info lookup cost for very small arrays.
      • Limit calculated rows to the number of rows in the table
      • Ensure that test_quick_select doesn't return more rows than in the table

      A lot of other optimizer related issues, documented at
      https://mariadb.com/kb/en/the-optimizer-cost-model-from-mariadb-11-0/

      Attachments

        Issue Links

          Activity

            monty Michael Widenius created issue -
            monty Michael Widenius made changes -
            Field Original Value New Value
            Status Open [ 1 ] In Progress [ 3 ]
            serg Sergei Golubchik made changes -
            Description There is a cleanup task for several things in the optimizer.

            - Ensure that selectivity is <= 0
            - Ensure that selectivity calculation doesn't return too few row
            - Calculate and use index only cost when appropriate.
            - Examine and improve cost calculation in the optimizer for
              - filters
                 - Ensure that filter cost calculation also include index only cost and compare with WHERE
              - ranges
              - table scans
              - hash and full joins
              - group by

            - Adjusted Range_rowid_filter_cost_info lookup cost for very small arrays.
            - Limit calculated rows to the number of rows in the table
            - Ensure that test_quick_select doesn't return more rows than in the table

            There is a cleanup task for several things in the optimizer.

            - Ensure that 0 <= selectivity <= 1
            - Ensure that selectivity calculation doesn't return too few row
            - Calculate and use index only cost when appropriate.
            - Examine and improve cost calculation in the optimizer for
              - filters
                 - Ensure that filter cost calculation also include index only cost and compare with WHERE
              - ranges
              - table scans
              - hash and full joins
              - group by

            - Adjusted Range_rowid_filter_cost_info lookup cost for very small arrays.
            - Limit calculated rows to the number of rows in the table
            - Ensure that test_quick_select doesn't return more rows than in the table

            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 126997 ] MariaDB v4 [ 131853 ]
            monty Michael Widenius made changes -

            Hello Michael,

            I am interested in understanding this task in detail. The description for this task is very concise and hard to understand what the task is really about. It will be really great if you could elaborate each point in detail.

            Few specific questions:
            1. The description says "Ensure that 0 <= selectivity <= 1" – does this mean this task applies only when optimizer_use_condition_selectivity=1 ?
            2. What MariaDB versions are affected by this cleanup task ?

            Please let me know.

            Thank you
            Thejaka

            thejaka Thejaka Kanewala added a comment - Hello Michael, I am interested in understanding this task in detail. The description for this task is very concise and hard to understand what the task is really about. It will be really great if you could elaborate each point in detail. Few specific questions: 1. The description says "Ensure that 0 <= selectivity <= 1" – does this mean this task applies only when optimizer_use_condition_selectivity=1 ? 2. What MariaDB versions are affected by this cleanup task ? Please let me know. Thank you Thejaka
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            julien.fritsch Julien Fritsch made changes -
            Priority Major [ 3 ] Critical [ 2 ]

            Answer to Thejaka:
            1) It applies always
            2) I am working on MariaDB 10.7 code base. Will move it to the next alpha MariaDB version when done.

            You can find out more what is already done by examining 10.7-selectivity branch.
            The last commit is still work on progress (test results are not yet up to date). code is more or less correct, but a lot of additional work is done in my tree. The commit messages contains a lot of information of what has been done.

            monty Michael Widenius added a comment - Answer to Thejaka: 1) It applies always 2) I am working on MariaDB 10.7 code base. Will move it to the next alpha MariaDB version when done. You can find out more what is already done by examining 10.7-selectivity branch. The last commit is still work on progress (test results are not yet up to date). code is more or less correct, but a lot of additional work is done in my tree. The commit messages contains a lot of information of what has been done.
            monty Michael Widenius made changes -
            Description There is a cleanup task for several things in the optimizer.

            - Ensure that 0 <= selectivity <= 1
            - Ensure that selectivity calculation doesn't return too few row
            - Calculate and use index only cost when appropriate.
            - Examine and improve cost calculation in the optimizer for
              - filters
                 - Ensure that filter cost calculation also include index only cost and compare with WHERE
              - ranges
              - table scans
              - hash and full joins
              - group by

            - Adjusted Range_rowid_filter_cost_info lookup cost for very small arrays.
            - Limit calculated rows to the number of rows in the table
            - Ensure that test_quick_select doesn't return more rows than in the table

            There is a cleanup task for several things in the optimizer.

            - Ensure that 0 <= selectivity <= 1
            - Ensure that selectivity calculation doesn't return too few row
            - Calculate and use index only cost when appropriate.
            - Examine and improve cost calculation in the optimizer for:
              - filters
                 - Ensure that filter cost calculation also include index only cost and compare with WHERE
              - ranges
              - table scans
              - hash and joins and cached full joins
              - group by

            - Adjusted Range_rowid_filter_cost_info lookup cost for very small arrays.
            - Limit calculated rows to the number of rows in the table
            - Ensure that test_quick_select doesn't return more rows than in the table

            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            serg Sergei Golubchik made changes -
            Fix Version/s 10.9 [ 26905 ]
            Fix Version/s 10.8 [ 26121 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.10 [ 27530 ]
            Fix Version/s 10.9 [ 26905 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 10.11 [ 27614 ]
            Fix Version/s 10.10 [ 27530 ]
            serg Sergei Golubchik made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            serg Sergei Golubchik made changes -
            Fix Version/s 11.0 [ 28320 ]
            Fix Version/s 10.11 [ 27614 ]
            serg Sergei Golubchik made changes -
            Status In Progress [ 3 ] In Testing [ 10301 ]
            serg Sergei Golubchik made changes -
            Assignee Michael Widenius [ monty ] Elena Stepanova [ elenst ]
            monty Michael Widenius made changes -
            monty Michael Widenius made changes -
            Description There is a cleanup task for several things in the optimizer.

            - Ensure that 0 <= selectivity <= 1
            - Ensure that selectivity calculation doesn't return too few row
            - Calculate and use index only cost when appropriate.
            - Examine and improve cost calculation in the optimizer for:
              - filters
                 - Ensure that filter cost calculation also include index only cost and compare with WHERE
              - ranges
              - table scans
              - hash and joins and cached full joins
              - group by

            - Adjusted Range_rowid_filter_cost_info lookup cost for very small arrays.
            - Limit calculated rows to the number of rows in the table
            - Ensure that test_quick_select doesn't return more rows than in the table

            There is a cleanup task for several things in the optimizer.

            - Ensure that 0 <= selectivity <= 1
            - Ensure that selectivity calculation doesn't return too few row
            - Calculate and use index only cost when appropriate.
            - Examine and improve cost calculation in the optimizer for:
              - filters
                 - Ensure that filter cost calculation also include index only cost and compare with WHERE
              - ranges
              - table scans
              - hash and joins and cached full joins
              - group by

            - Adjusted Range_rowid_filter_cost_info lookup cost for very small arrays.
            - Limit calculated rows to the number of rows in the table
            - Ensure that test_quick_select doesn't return more rows than in the table

            A lot of other optimizer related issues, documented at
            https://mariadb.com/kb/en/the-optimizer-cost-model-from-mariadb-11-0/
            monty Michael Widenius made changes -
            issue.field.resolutiondate 2022-12-27 18:03:55.0 2022-12-27 18:03:55.285
            monty Michael Widenius made changes -
            Fix Version/s 11.0.0 [ 28500 ]
            Fix Version/s 11.0 [ 28320 ]
            Resolution Fixed [ 1 ]
            Status In Testing [ 10301 ] Closed [ 6 ]
            monty Michael Widenius made changes -
            Resolution Fixed [ 1 ]
            Status Closed [ 6 ] Stalled [ 10000 ]
            monty Michael Widenius made changes -
            Comment [ Was fixed as by the fix for MDEV-30098 ]
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            monty Michael Widenius made changes -
            serg Sergei Golubchik made changes -
            Fix Version/s 11.0 [ 28320 ]
            Fix Version/s 11.0.0 [ 28500 ]
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            alice Alice Sherepa made changes -
            elenst Elena Stepanova made changes -
            Status Stalled [ 10000 ] In Testing [ 10301 ]
            elenst Elena Stepanova made changes -
            monty Michael Widenius made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            Assignee Elena Stepanova [ elenst ] Sergei Golubchik [ serg ]
            Status In Testing [ 10301 ] Stalled [ 10000 ]
            serg Sergei Golubchik made changes -
            Fix Version/s 11.0.1 [ 28548 ]
            Fix Version/s 11.0 [ 28320 ]
            Assignee Sergei Golubchik [ serg ] Michael Widenius [ monty ]
            Resolution Fixed [ 1 ]
            Status Stalled [ 10000 ] Closed [ 6 ]
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            elenst Elena Stepanova made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            mariadb-jira-automation Jira Automation (IT) made changes -
            Zendesk Related Tickets 201658
            Zendesk active tickets 201658

            People

              monty Michael Widenius
              monty Michael Widenius
              Votes:
              0 Vote for this issue
              Watchers:
              11 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.