Mysql partition management, mysql Partition
The purpose of a hash partition is to evenly distribute data to each partition after hash calculation based on a column. Compared with range and list partitions, the hash partition does not need to explicitly specify a given column value or column value set.
Which partition should be stored in? mysql will automatically perform this operation based on hash calculation. We only need to specify a column or expression based on the column value to be hashed, and the number of optional partitions of the table to be partitioned.
The following is an example of how to create a hash partition. First, create the following table hash_partition_tbl and insert several records into the table, as shown below:
We also take a look at how the corresponding tablespace files are distributed (note that we have set innodb_file_per_table = 1, that is, each form has a unique ibd file ), we can see in the corresponding datadir directory:
Because we are divided into four hash partitions, we can see four tablespace files, which are hash_partition_tab.