Skip to content

Partition ordering for multi-column keys is incorrect #60

@jcjones

Description

@jcjones

Given the partition layout:

PARTITION `p_20220413` VALUES LESS THAN (2300107903,2178845982) ENGINE = InnoDB,
 PARTITION `p_20220513` VALUES LESS THAN (2517982016,2390412410) ENGINE = InnoDB,
 PARTITION `p_20220508` VALUES LESS THAN (2661645087,2536435703) ENGINE = InnoDB,
 PARTITION `p_20220525` VALUES LESS THAN (2805308158,2682458996) ENGINE = InnoDB,
 PARTITION `p_20220611` VALUES LESS THAN (7882495694,7856340600) ENGINE = InnoDB,
 PARTITION `p_20230519` VALUES LESS THAN (10790547177,11048018089) ENGINE = InnoDB,
 PARTITION `p_20230724` VALUES LESS THAN (95233456870,97348306298) ENGINE = InnoDB,
 PARTITION `p_20230823` VALUES LESS THAN (MAXVALUE,MAXVALUE) ENGINE = InnoDB

and the position (8236363504, 6096301914), current versions of Partition Manager will assume the "current" partition is p_20220611. However, that is not correct: MySQL writes into the next partition if any of those values moves beyond the limits of a partition, not if all do.

In reality, partition p_20230519 is the "current" one.

To quote from the documentation:

With RANGE COLUMNS, a row matches a partition if all row values are less than specified values. The first partition that matches row values will be used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions