MySQL Partition Table-- advantages and disadvantages of the partition table

Partition Table History

1, MySQL 5.1 version began to support the partition table based on an integer column,
2, MySQL 5.5 version began to support RANGE and LIST partitions, support TRUNCATE partition, the new partition COLUMNS keyword simplified definition.
3, MySQL 5.6 version began to support the swap partition, partition support explicit queries, supports up to 8182 partitions or sub-partitions.
4, MySQL 5.7 version introduces local partitioning strategy, and mark the abandoned common partitioning strategy.

 

Partitioning strategy

According to Open partition management behavior partitioning strategies can be divided into two categories:
1, General partitioning strategy (Generic Partitioning), responsible for the MySQL Server access control layer partition.
2, local partitioning strategy (Native Partitioning), responsible for controlling access to the storage engine layer partition.

When MySQL started supporting the partition table, partition table access control operations on the MySQL Server layer implementation, as a result more rough, there are serious problems in terms of performance document management / table management. Different layers use different storage engines storage mechanism / structure of the index / access control (lock), can enhance or optimize specific operating through a special design, the partition is placed in the access control policy storage engine better.


Common partitioning strategy issues:
1, when the partition table is first accessed, regardless of the number of visits required to operate a partition, you need to access all partitions on the partition table, causing performance problems. When a large number of partitions on a partitioned table, probably because of the number of open files that exceed the parameters open_file_limit limit and error.
2, when the partition table can be maintained by the partition while maintaining the original file and the new file partition, the partition table, as will be extended from the partition 100 to partition 101, 100 need to + 2 * 2 * 101 = 402 file descriptors.


In MySQL 5.7.9 version, InnoDB introduction of local partitioning strategy, internal management access InnoDB storage engine layer by the partition table behavior.
In MySQL 5.7.17 release, MySQL will be marked as deprecated common partitioning strategy
In MySQL 8.0, MyISAM engine no longer allowed to use the partition table, because MyISAM engine does not support local partitioning strategy.
Currently, only two storage engine InnoDB and NDB support local partitioning strategy.

 

MySQL 5.7 Partitioning enhancements

MySQL 5.7 Partitioning enhancements:
1, MySQL 5.7.1 started to support HANDLER statement (non-standard SQL statements, does not support DML operations to access data by specifying the index, the optimizer reduces parsing and optimizing SQL overhead, improve query performance.)
2, MySQL 5.7.2 to start sub-partition support ANALYZE / CHECK / OPTIMIZE / REPAIR / TRUNCATE operation
3, MySQL5.7.3 support index condition pushdown (ICP) properties
4, MySQL 5.7.4 support for the InnoDB table partitioning options FLUSH TABLES FOR EXPORT
5, support the use of cache to improve performance Load data, each partition uses 130KB buffer
6, supports the use of CACHE INDEX and LOAD INDEX INTO CACHE statement against the partition table support MyISAM index cache

 

Partition Table advantages

In MySQL Server layer partition table is a table in the partition table MySQL storage engine layer is a plurality of tables, and therefore has the following characteristics:
1, the partition table on the business transparent, only need to maintain the data structure of a table.
2, DML operation lock affects only the partition, does not affect the operation of unvisited partition.
3, the data quickly swapped in and out through the partition partition table exchange.
4, quickly clean up specific partition data by TRUNCATE operation.
5, access to a specific data partition by forcing partition only affect the reduction operation.
6, by the large amount of data partitions can effectively reduce the number of layers of index to improve query performance.

 

Partition Table shortcomings

Since the partition table in MySQL Server layer is a table, thus:
1, DDL operations need to lock all partitions, resulting operations are blocked on all partitions.
2, when a small amount of data table, partition tables and non-partitioned tables similar properties, the effect of the partition table is limited.
3, when a large amount of data tables, partition table or other high DDL operation and maintenance operation is difficult risks.
4, when a single server can not meet the performance, high cost of the split partition table.
5, the partition table to use less, there is an unknown risk of multiple, multi-BUG BUG BUG and more and more, MySQL Community Edition free, low-cost scale, simple and perfect middleware sub-library sub-table implementation.

 

Guess you like

Origin www.cnblogs.com/gaogao67/p/11013244.html