DelphiFAQ Home Search:

What is the MERGE statement good for?

 

commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

With version 3.23.25, mysql introduced MERGE tables.

A MERGE table is a collection of identical MyISAM tables that can be used as one. You can only SELECT, DELETE, and UPDATE from the collection of tables. If you DROP the MERGE table, you are only dropping the MERGE specification.

In order to be able to be MERGEd, the involved tables have to have identical column and key information. You cannot merge tables in which the columns are packed differently, doesn't have exactly the same columns, or have the keys in different order. Using myisampack on some of the tables is ok.

Some benefits of using MERGE:


  • sometimes you can restrict your search on one or two of the individual tables (faster search)
  • in mysql each table corresponds to a file in the file system. Instead of having one very big file you'll have 4 files representing 4 tables. If something goes wrong (corrupted), you'll need to restore only one of the 4 files.
  • You can use MERGE to create an alias/synonym for a table by just using MERGE over this one table without any notable performance

Note:
REPLACE doesn't work on MERGE tables.

The official documentation is here:
http://dev.mysql.com/doc/mysql/en/MERGE.html


Content-type: text/html

Comments:

2015-02-26, 04:44:34
anonymous from Netherlands  
comes http://viagra-e.net fun chronic used http://levitra-e.com supply blood abnormally long http://cialis-i.com drug

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: