MySQL under Merge sub-table

Source: Internet
Author: User
1.merge Introduction The table is a table of n records, divided into a number of tables, the sum of the records of each table is still n. There are many ways to divide a table, and it is the simplest way to divide the table with a merge. Merge is a storage engine for MySQL that uses a set of MYISAM data tables as a logical unit. CREATE table ' t ' (' ID ' int () unsigned not Null auto_increment, ' data ' varchar not NULL, PRIMARY KEY (' id ') "ENGINE = MERGE UNION = (T1, t2) Insert_method = last; Medium engine = Merge indicates that the merge engine is used. In addition engine = Mrg_myisam is the same meaning. UNION = (T1, t2) indicates that the T1,T2 table Insert_method = Last represents the insertion method. 0 Insert is not allowed, first is inserted into the Union in table one, and last is inserted into the final table in the union. 2.merge data storage structure in MySQL, each table in the MyISAM engine corresponds to three files:. MyD data file,. Myi index file,. frm table structure file. However, each table under the merge engine has only one. mrg file. MRG contains the relationship of the tables and the way in which the data is inserted. It's like a shell, or a connection pool, where the data is stored in a sub-table. 3.CRUD for additions and deletions, the direct operation of the general table T is possible. 4. Notes A. Duplicate record/Repeat index the table t1/t2 already exists before the merge table is established, and duplicate records exist in the t1/t2. When a query is encountered, an entry that satisfies the record is returned. This means that only one record will be displayed, and no error will be presented. If you create a merge table, and you insert/update, you will be prompted with a duplicate index. The merge table is only responsible for operations after the table is created b. How to delete a sub-table cannot delete a table directly, which destroys the merge table. The correct method is: ALTER TABLE t ENGINE = Mrg_myisam UNION = (t1) insert_method = Last;drop table t1c. Mistakenly delete the merge table by mistake, it will not cause data loss, just Re-create the summary table

MySQL under Merge sub-table

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.