CREATE TABLE t2 ( col1 INT NOT NULL, col2 DATE NOT NULL, col3 INT NOT NULL, col4 INT NOT NULL, UNIQUE KEY (col1), UNIQUE KEY (col3) ) PARTITION BY HASH(col1 + col3) PARTITIONS 4; CREATE TABLE t1 ( col1 INT NOT NULL, col2 DATE NOT NULL, col3 INT NOT NULL, col4 INT NOT NULL, UNIQUE KEY (col1, col2, col3) ) PARTITION BY HASH(col3) PARTITIONS 4; CREATE TABLE t2 ( col1 INT NOT NULL, col2 DATE NOT NULL, col3 INT NOT NULL, col4 INT NOT NULL, UNIQUE KEY (col1, col3) ) PARTITION BY HASH(col1 + col3) PARTITIONS 4; mysql>  CREATE TABLE t3 ( -> col1 INT NOT NULL, -> col2 DATE NOT NULL, -> col3 INT NOT NULL, -> col4 INT NOT NULL, -> UNIQUE KEY (col1, col2), -> UNIQUE KEY (col3) ->  ) ->  PARTITION BY HASH(col1 + col3) ->  PARTITIONS 4; ERROR 1491 (HY000): A PRIMARY KEY must include all columns in the table’s partitioning function mysql>  CREATE TABLE t3 ( -> col1 INT NOT NULL, -> col2 DATE NOT NULL, -> col3 INT NOT NULL, -> col4 INT NOT NULL, -> UNIQUE KEY (col1, col2, col3), -> UNIQUE KEY (col3) ->  ) ->  PARTITION BY HASH(col3) 4721 The  CREATE TABLE  statement fails because both  col1  and  col3  are included in the proposed partitioning key, but neither of these columns is part of both of unique keys on the table. This shows one possible fix for the invalid table definition: This example shows the error produced in such cases: Each of the following statements is valid, and represents one way in which the corresponding invalid table creation statement could be made to work: In each case, the proposed table would have at least one unique key that does not include all columns used in the partitioning expression. Partitioning Keys, Primary Keys, and Unique Keys