MySQL List partition (3), mysqllist Partition
For details, see MySQL partition 1.
Example: Here is my personal learning summary.
How does mysql partition existing tables?
I am also looking for a method. mysql has been able to partition tables since 5.1.
What is the relationship between the mysql partition field and the where condition?
1. Why is the number of records executed in two tables the same when no index is added? Is the partition field c3 required to be included in the where Condition for the partition to take effect?
Right.
Because you are still not partitioned. Where c2 = '1'
The final result is "full table scan"
For a partitioned table, each row in each partition must be scanned to see if the where c2 = '1' condition is met.
For unpartitioned tables, each row of the table is scanned.
2. After the index is added, the number of records executed in the partition of unpartitioned tables is even smaller. Why?
I guess the index on your partition table is a local index.
That is, when where c3 =... and c2 =..., we can achieve the best results.
When only where c2 =.
First, you must judge each partition in sequence and then use the index in that partition.
Therefore, the resource consumption is higher than that of the non-partition table.