Why is the number of slices not displayed for some indexes?

Suresh Ramagiri -


The number of slices for an index is only displayed when it differs from the number of slices of the base table. For instance, if a table is created with 3 slices then the indexes are also created with 3 slices, but because the slice counts are the same, the SLICES=3 on the index will be hidden. As the table grows often the base table is split at a different interval than the indexes, leading to them having a different number of slices than the base table, in this case the slices will then be displayed.


CREATE TABLE `table1` (
 `id` int(11) not null AUTO_INCREMENT,
`user_id` varchar(127) not null,
`type` char(50) not null default 'foo',
 PRIMARY KEY (`id`) /*$ DISTRIBUTE=1 */,
KEY `idx_idtype`(`id`,`type`)/*$ DISTRIBUTE=2 */
KEY `idx_user_id` (`user_id`) /*$ DISTRIBUTE=2 SLICES=6 */

In the above example the base representation has a designation of SLICES=19, while the key idx_user_id has SLICES=6 and the key idx_idtype has no SLICES . Because there is no SLICES designation for idx_user_id we know that it has the same number of slices as the base rep, 19. It is only because the number of slices for the key idx_user_id is different from the base rep that the SLICES=6 designation is displayed.

Have more questions? Submit a request


Please sign in to leave a comment.
Powered by Zendesk