How do You determine whether partitions are supported in mysql

  • 2020-11-26 19:01:38
  • OfStack

mysql can determine whether partitions are supported by the following statement:

SHOW VARIABLES LIKE '%partition%';

If output:

have_partitioning YES

Indicates that partitions are supported.

Or by:

SHOW PLUGINS;

Displays all the plug-ins, indicating that partitioning is supported if partition ACTIVE STORAGE ENGINE GPL plug-ins are available

ps: What is database partitioning

Some time ago, I wrote an article about mysql sub-table. The following is what is database partition, taking mysql as an example. The data in mysql database is stored on disk in the form of files, which is placed under /mysql/data by default (can be viewed through datadir in ES35en.cnf). One table mainly corresponds to three files, one is for frm to store table structure, one is for myd to store table data, and one is for myi to store table index. 1 table if the amount of data is too large, so myd, myi becomes large and search data will become slow, this time we can use mysql partition function, in physics, this one form corresponding to the three documents, divided into many small pieces, so, when we find 1 the data, need not all find out, as long as know where the data is 1 piece, and then in the 1 piece. If the data in the table is too big, one disk may not fit. At this time, we can allocate the data to different disks.

Two ways to partition

1. Horizontal partitioning

What is horizontal partitioning? Is horizontal to partition, for example to illustrate 1, if there are 100W data, divided into 10, the first 10W data in the first partition, the second 10W data in the second partition, and so on. So you divide the table into 10 points, and you divide the root by merge, kind of like that. When one piece of data is fetched, it contains all the fields in the table structure, that is, the horizontal partition, and does not change the table structure.

2. Longitudinal partitioning

What is vertical partitioning? Is vertical to the partition, for example, to illustrate the design when the users table, at the start of the did not consider good, and put all personal information in a table, so that this table will have larger fields, such as profiles, and these profiles, may not have many people to see, so wait until someone wants to see, to find, table, can put such a big field, to separate.


Related articles: