Mysql merge table sharding

Source: Internet
Author: User

Mysql merge TABLE sharding: www.2cto.com create table 'test _ 1' (id INT (11) not null default '0', email varchar (50) not null, primary key ('id') ENGINE = MyISAM default charset = UTF8; create table 'test _ 2' (id INT (11) not null default '0 ', email varchar (50) not null, primary key ('id') ENGINE = MyISAM default charset = UTF8; create table 'test _ 3' (id INT (11) not null default '0', email varchar (50) NOT NUL L, primary key ('id') ENGINE = MyISAM default charset = UTF8; a summary TABLE: www.2cto.com create table 'test' ('id' INT (11) not null default '0' email varchar (50) not null key 'I _ id' ('id'),) ENGINE = MRG_MyISAM UNION = (test_1, test_2, test_3) default charset = UTF8; if you select * on the test table, the data in the three sub-tables will be taken out. When inserting data, perform the modulo operation based on the hash code of the object. If the remainder is 3, insert the table test_3.

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.