Partition information
This section discusses obtaining information about existing partitions, which can be done in a number of ways.
How to do it...
Let's get into the details.
Using SHOW CREATE TABLE
To know whether a table is partitioned or not, you can execute the SHOW CREATE TABLE\G
statement, which shows the table definition along with partitions, for example:
mysql> SHOW CREATE TABLE employees \G *************************** 1. row *************************** Table: employees Create Table: CREATE TABLE `employees` ( `emp_no` int(11) NOT NULL, `birth_date` date NOT NULL, `first_name` varchar(14) NOT NULL, `last_name` varchar(16) NOT NULL, `gender` enum('M','F') NOT NULL, `hire_date` date NOT NULL, `address` varchar(100) DEFAULT NULL, PRIMARY KEY (`emp_no`,`hire_date`), KEY `name` (`first_name`,`last_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 /*!50100 PARTITION BY RANGE (YEAR(hire_date)) (PARTITION p1980 VALUES LESS THAN (1980) ENGINE = InnoDB, PARTITION p1990...