The default sharding key is still the primary key!
To see that 7.5.4 does not behave as hidden pk case in 7.2.26, look also in the other columns of explain output. The partitions column should be ignored for NDB tables.
Still, you found a bug. The explain output should not depend on how partitioning is specified as long as it is the same.
For NDB the partition pruning is actually not done by the optimizer in MySQL server but within NDB itself.
To inspect the table definition used within NDB one can use ‘ndb_desc -d shard_check_pk’ it should reveal that there are no extra hidden columns, and also that the sharding key called distribution key in NDB is the same as the primary key.
LikeLiked by …
[Read more]