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

PARTITION BY KEY ALGORITHM={crc32|murmur|...}

    XMLWordPrintable

Details

    Description

      As of 10.5, MariaDB supports 1 and 2 in the ALGORITHM option of a PARTITION clause:

      CREATE TABLE t1 (a VARCHAR(64)) PARTITION BY KEY ALGORITHM=1 (a) PARTITIONS 4;
      CREATE TABLE t1 (a VARCHAR(64)) PARTITION BY KEY ALGORITHM=2 (a) PARTITIONS 4;
      

      where:

      • 1 means MySQL 5.1 hash
      • 2 means MySQL 5.5 hash

      The built-in hash functions are not always good. For example, on BINARY-alike or VARBINARY-alike data types the distribution is not good when the data has many zero bytes.

      See MDEV-20791 as an example of a bad distribution.

      In order to improve distribution, let's implement more hash options, e.g. crc32, murmur:

      CREATE TABLE t1 (a VARCHAR(64)) PARTITION BY KEY ALGORITHM=crc32 (a) PARTITIONS 4;
      CREATE TABLE t1 (a VARCHAR(64)) PARTITION BY KEY ALGORITHM=murmur (a) PARTITIONS 4;
      

      New algorithm options will be identified by textual names instead of numbers. As this is more readable.

      The old values of 1 and 2 will remain as numbers (for backward compatibility). Optionally, they can get textual aliases, e.g. mysql51 or mysql55:

      ALGORITH=mysql51
      

      Attachments

        Issue Links

          Activity

            People

              holyfoot Alexey Botchkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              8 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.