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

Add an option to count records_in_range calls and skip them for point lookups

    XMLWordPrintable

Details

    Description

      Based on discussion with monty.

      Motivation

      There is some benchmarking effort where we suspect that records_in_range() calls make MariaDB slower than it could be.
      The ranges being scanned are point lookups which have only a few records.

      Note: there is another benchmark where I got a suspicion there might be a problem in records_in_range(), or recent changes to what InnoDB does in the function.

      Solution

      Skip records_in_range() when necessary.

      Create a patch that adds an option to skip records_in_range() for equality intervals.
      The record estimate can be taken from rec_per_key index statistics.

      The decision whether to skip records_in_range() could be a configurable parameter: e.g. skip records_in_range() if the rec_per_key tells the range has at most N rows.

      TODO: If the lookup value uses one keypart and have histogram on the column, would using n_distinct from the histogram give any advantage?

      TODO: Or, we could examine the histogram to see if there are popular columns.

      TODO: Or, we could just ask the histogram to estimate #rows for the key=const we have.

      Add a counter.

      Add a counter to count records_in_range( ) calls. Without it, it might be hard to check the above patches.

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            psergei Sergei Petrunia
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.