Mysql database KEY partition usage partitioning by KEY is similar to partitioning by HASH. In addition to the User-Defined expression used by HASH partition, the HASH function of KEY partition is provided by the MySQL server. MySQL Cluster uses the MD5 () function to implement KEY partitioning. For tables using other storage engines, the server uses its own internal hash function,
Mysql database KEY partition usage partitioning by KEY is similar to partitioning by HASH. In addition to the User-Defined expression used by HASH partition, the HASH function of KEY partition is provided by the MySQL server. MySQL Cluster uses the MD5 () function to implement KEY partitioning. For tables using other storage engines, the server uses its own internal hash function,
Mysql database KEY partition usage
Partitioning by KEY is similar to partitioning by HASH. Except for the User-Defined expression used by HASH partition, the HASH function of KEY partition is provided by the MySQL server. MySQL Cluster uses the MD5 () function to implement KEY partitioning. For tables using other storage engines, the server uses its own internal hash function, which is based on () the same algorithm.
The syntax for "create table... partition by key" is similar to creating a TABLE with HASH partitions. The only difference between them is that the KEY keyword is used instead of HASH, and the KEY partition uses only one or more column names.
It is also possible to split a table using a linear KEY. The following is a simple example:
Create table tk (
Col1 int not null,
Col2 CHAR (5 ),
Col3 DATE
)
Partition by linear key (col1)
PARTITIONS 3;
Using the keyword LINEAR in the KEY partition has the same effect as using it in the HASH partition. The number of the partition is obtained through the power of 2 (powers-of-two) algorithm, instead of using a modulus algorithm.