I have a MySQL (5.6.17) table with a few million records that I wish to partition. In order to do this, I use this query:
ALTER TABLE tablename PARTITION BY HASH(id) PARTITIONS 8;
Seems to work fine and PHPMyAdmin reports 8 partitions, with the data sufficiently distributed amongst the partitions.
If I repeat the exact same query, PHPMyAdmin again reports 8 partitions, but with a completely different distribution of the data. Every time I run the query, it results in different distributions.
The MySQL documentation says HASH does a modulus on the data, so it should be repeatable and produce the same results every time.
Can anybody explain what is happening? Is PHPMyAdmin reporting it wrong? Does HASH() do something else than a simple modulus?
p.s. The column type used for the ID is an
INT and I'm testing on a non-live table, so content is unchanged between queries.
EXPLAIN PARTITIONS on some queries seems to indicate the records are partitioned by modulus.