Hash & Key Partitioning
Learn Hash & Key Partitioning (Partitioning, MySQL) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Introduction HASH partitioning distributes rows by MOD(expression, N) over N partitions; KEY partitioning does the same using MySQL's internal hash function over one or more columns (defaulting to the primary key), so it works with non-integer columns too. LINEAR variants use a power-of-two algorithm that makes adding partitions cheaper but less even.