MySQL partition Overview

Source: Internet
Author: User


MySQL partition overview environment: www.2cto.com [html] mysql> select version (); + ----------- + | version () | + ----------- + | 5.5.28 | + ----------- + 1 row in set (0.00 sec) partition is a partition of the design mode of a table. It is partitioned and managed with the focus on high availability (management ), the secondary value is the performance improvement. In addition, the storage engine layer is transparent to the application layer. Supported partition types: For tables: partition horizontal partitioning → records of different rows in the same table are allocated to different physical files for the index: partial partial partition index → A partition stores both data and indexes. You can run the following command to check whether the current database has enabled the partition Function: [SQL] mysql> show variables like '% partition % '; + ------------------- + ------- + | Variable_name | Value | + ----------------- + ------- + | have_partitioning | YES | + ------------------- + ------- + 1 row in set (0.00 sec) MySQL partition type: ● RANGE partition ●list partition ●hash partition ●key partition no matter what type of partition is created, if the table has a primary KEY or a unique index, the partition column must be an integral part of the unique index. [SQL] mysql> create table t (col1 int not null,-> col2 int not null,-> col3 int not null,-> col4 int not null, -> unique key (col1, col2)-> partition by hash (col3)-> partitions 4; ERROR 1503 (HY000 ): a primary key must include all columns in the table's partitioning function mysql> create table t (col1 int not null,-> col2 int not null,-> col3 int not null, -> col4 int not null,-> unique key (col1, col2)-> partition by hash (col2)-> partitions 4; Query OK, 0 rows affected( 0.08 sec)

Related Article

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.