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

cost-based optimizer choice for k-NN indexes

Details

    Description

      optimizer needs to be able to make a cost-based choice whether to use k-NN index for ORDER BY ... LIMIT or not

      Attachments

        Issue Links

          Activity

            adamluciano Adam Luciano added a comment -

            How much of a positive impact to performance may we see from enabling this feature?

            adamluciano Adam Luciano added a comment - How much of a positive impact to performance may we see from enabling this feature?

            the point is — optimizer needs to decide whether to use a vector index, a some other index, or a full table scan based on the cost of each execution plan, it needs to select the fastest.

            It doesn't do that now, so you can tweak the data to get any speedup you want. For example, something like

            SELECT * FROM t1 WHERE a=1 ORDER BY VEC_DISTANCE_EUCLIDEAN(vec, ...) LIMIT 5;
            

            If a=1 matches almost the whole table, then vector index will be the fastest execution plan. If a=1 matches only few rows out of millions, vector index will be a horrible choice.

            serg Sergei Golubchik added a comment - the point is — optimizer needs to decide whether to use a vector index, a some other index, or a full table scan based on the cost of each execution plan, it needs to select the fastest. It doesn't do that now, so you can tweak the data to get any speedup you want. For example, something like SELECT * FROM t1 WHERE a=1 ORDER BY VEC_DISTANCE_EUCLIDEAN(vec, ...) LIMIT 5; If a=1 matches almost the whole table, then vector index will be the fastest execution plan. If a=1 matches only few rows out of millions, vector index will be a horrible choice.

            People

              Unassigned Unassigned
              serg Sergei Golubchik
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.