MySQL query efficiency after partitioning

Source: Internet
Author: User

Preparatory work:

  Worm Copy article table adds data to 1.12 million

Syntax: INSERT INTO TABLENAMEA select * from Tablenameb

Non-partitioned query 54s

  

Changing an existing table partition

Alter Tablet_articlepartition byRANGE (Aid) (PARTITION p0VALUESLess THAN (200000), PARTITION p1VALUESLess THAN (400000), PARTITION p2VALUESLess THAN (600000), PARTITION P3VALUESLess THAN (800000), PARTITION P4VALUESLess THAN (1000000), PARTITION P5VALUESLess THAN (2000000), PARTITION PmaxVALUESLess THAN MAXVALUE);

To delete a table partition

ALTER TABLE DROP PARTITION partition name;   

query time after partition 1.2 s


总结:mysql 中分区可大大增加查询速度,原理和横向分割数据一样,只不过mysql自身做了处理。

MySQL query efficiency after partitioning

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.