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

Handle range scan SEL_ARG overallocation gracefully.

Details

    Description

      The optimizer can perform a range scan and build a SEL_TREE.

      When attempting to allocate more than optimizer_max_sel_args (thd->variables.optimizer_max_sel_args), Item_cond::get_mm_tree() will abort all range scans and potentially revert to a full table scan.

      This issue is created to explore more useful alternatives to this.

      Attachments

        Issue Links

          Activity

            Johnston Rex Johnston added a comment - - edited

            One obvious improvement to my suggested patch is to choose which key to remove, rather than the easiest (which is the last one).

            Questions
            1) how are key_parts ordered?
            2) how do we know which key might be best to deactivate?
            Shortest? Longest? Coverage?
            What are optimal conditions for an index merge?
            Having 2 keys mostly similar has showing itself to be terrible, so perhaps we need to compare keys to each other and deactivate one that is most like another one.

            Speaking with sanja_byelkin, the idea of free-ing up memory isn't applicable, so we are stuck with these objects left in memory until the statement has finished executing. This isn't terribly great in the context of prepared statements/SP <check this>.

            Perhaps we might be able to estimate how many SEL_ARGS we are going to allocate and trim used keys first.

            • depends on the structure of the condition being evaluated.
            Johnston Rex Johnston added a comment - - edited One obvious improvement to my suggested patch is to choose which key to remove, rather than the easiest (which is the last one). Questions 1) how are key_parts ordered? 2) how do we know which key might be best to deactivate? Shortest? Longest? Coverage? What are optimal conditions for an index merge? Having 2 keys mostly similar has showing itself to be terrible, so perhaps we need to compare keys to each other and deactivate one that is most like another one. Speaking with sanja_byelkin , the idea of free-ing up memory isn't applicable, so we are stuck with these objects left in memory until the statement has finished executing. This isn't terribly great in the context of prepared statements/SP <check this>. Perhaps we might be able to estimate how many SEL_ARGS we are going to allocate and trim used keys first. depends on the structure of the condition being evaluated.

            People

              Johnston Rex Johnston
              Johnston Rex Johnston
              Votes:
              0 Vote for this issue
              Watchers:
              3 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.