Mysql database KEY partition usage

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.