Топ-100
 

MERGE

База данных: MySQL
Текст

The MERGE storage engine, also known as the MRG_MyISAM engine, is a
collection of identical MyISAM tables that can be used as one.
"Identical" means that all tables have identical column data types and
index information. You cannot merge MyISAM tables in which the columns
are listed in a different order, do not have exactly the same data
types in corresponding columns, or have the indexes in different order.
However, any or all of the MyISAM tables can be compressed with
myisampack. See
https://dev.mysql.com/doc/refman/8.0/en/myisampack.html. Differences
between tables such as these do not matter:

o Names of corresponding columns and indexes can differ.

o Comments for tables, columns, and indexes can differ.

o Table options such as AVG_ROW_LENGTH, MAX_ROWS, or PACK_KEYS can
differ.

Пример

mysql> CREATE TABLE t1 (
-> a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
-> message CHAR(20)) ENGINE=MyISAM;
mysql> CREATE TABLE t2 (
-> a INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
-> message CHAR(20)) ENGINE=MyISAM;
mysql> INSERT INTO t1 (message) VALUES ('Testing'),('table'),('t1');
mysql> INSERT INTO t2 (message) VALUES ('Testing'),('table'),('t2');
mysql> CREATE TABLE total (
-> a INT NOT NULL AUTO_INCREMENT,
-> message CHAR(20), INDEX(a))
-> ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;