Small shell _mysql Partition instance

Source: Internet
Author: User

MySQL partition experimentBrief:I. Partitioning by partition typeII. Administrative Divisionexamples of partitions and non-partitioned tables

first, establish the partition to hash partition for example

(1), non-linear hash partition

1. Test table T_hash Structure

CREATE TABLE T_hash

(id int unsigned,

Name Char (1)

) Engine=myisam Charset=utf8

Partition by hash (ID)

Partitions 5;

2. T_hash Table physical file structure

3. Insert data into the T_hash table

4. View the physical structure of the table T_hash


Summary: Hash Partitioning is an average distribution. Therefore, the data file size for each partition is equal.

II. Administrative Division

1, for the hash partition

2. Adjust the partition number 5 to 2

3. Adjust the partition number 2 to 1

Summary: Once the hash is partitioned, at least one partition exists.

examples of partitions and non-partitioned tables

1. Test table

Non-partitioned table:

CREATE TABLE T2

(id int unsigned,

Name Char (1)

) Engine=myisam Charset=utf8;

Partition table:

CREATE TABLE T1

(id int unsigned,

Name Char (1)

) Engine=myisam Charset=utf8

Partition by hash (ID)

Partitions 4;


2. Inserting data with the same number of bars


3. Find data with Name a


(Note: Partitioning takes less time than unpartitioned if no index is added)


The quieter become,the more you is able to hear!

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Small shell _mysql Partition instance

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.