[MDEV-22831] PARTITION BY KEY ALGORITHM={crc32|murmur|...} Created: 2020-06-08  Updated: 2023-12-22

Status: Stalled
Project: MariaDB Server
Component/s: Data types, Partitioning
Fix Version/s: 11.5

Type: Task Priority: Major
Reporter: Alexander Barkov Assignee: Alexey Botchkov
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-20791 In table partitioned by INET6 all val... Open

 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



 Comments   
Comment by Sergei Golubchik [ 2021-06-29 ]

may be it's be better to use https://github.com/Cyan4973/xxHash and not murmur. xxHash seems to be faster, and also has quite good distribution

Comment by Julien Fritsch [ 2023-12-05 ]

Automated message:
----------------------------
Since this issue has not been updated since 6 weeks, it's time to move it back to Stalled.

Comment by JiraAutomate [ 2023-12-05 ]

Automated message:
----------------------------
Since this issue has not been updated since 6 weeks, it's time to move it back to Stalled.

Generated at Thu Feb 08 09:17:48 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.