This article describes how to determine whether partitions are supported in mysql. For more information, see the following statement to determine whether partitions are supported in mysql:
Show variables like '% partition % ';
If the output is:
Have_partitioning YES
Partitions are supported.
Or pass:
Show plugins;
Display all plug-ins. If the partition active storage engine gpl plug-in is available, partitions are supported.
Ps: What is database partition?
I wrote an article about mysql table sharding some time ago. The following describes what database partitioning is. take mysql as an example. The data in the mysql database is stored on the disk as a file, which is stored under/mysql/data by default (you can use my. in cnf), a table corresponds to three files, one is the frm table structure, the other is the myd table data, and the other is the myi table index. If the data volume of a table is too large, myd and myi will become very large, and the data query will become very slow. at this time, we can use the mysql partition function, physically, the three files corresponding to this table are divided into many small pieces. in this way, when we look for a piece of data, we don't need to look for it all, you only need to know where the data is, and then find it. If the data in the table is too large, it may not be stored on a disk. in this case, we can allocate data to different disks.
Two partitioning methods
1. Horizontal partitioning
What is a horizontal partition? It means partitioning in a horizontal manner. for example, if there are million pieces of data, divide the data into ten portions, and put the first 10 million pieces of data into the first partition, the second 10 million data records are placed in the second partition, and so on. That is to say, we divide the table into very many tables, and use merge as the root table. When a piece of data is retrieved, the data contains all fields in the table structure, that is, the horizontal partition does not change the table structure.
2. Vertical partitioning
What is vertical partitioning? The partition is vertical. for example, when designing a user table, we didn't consider it at the beginning, but put all the personal information in a table, in this way, there will be relatively large fields in this table, such as personal profiles, which may not be viewed by many people, so when someone looks at them, they will look for them, when you split a table, you can split such a large field.