I need to add partitions to an already partitioned table, the table has RANGE partitions by year(timestamp)
, but the previous admin stopped partitioning awhile ago. Now the table has grown to 4.1 million rows and counting, making the queries very slow. The old partitions are rarely (if ever) queried, so I need to keep on partitioning but this is a production DB hosted on AWS RDS.
Table partition section:
...
PARTITION BY RANGE (year(`timestamp`))
(PARTITION `p10` VALUES LESS THAN (2011) ENGINE = InnoDB,
PARTITION `p11` VALUES LESS THAN (2012) ENGINE = InnoDB,
PARTITION `p12` VALUES LESS THAN (2013) ENGINE = InnoDB,
PARTITION `p13` VALUES LESS THAN (2014) ENGINE = InnoDB,
PARTITION `p14` VALUES LESS THAN (2015) ENGINE = InnoDB,
PARTITION `p15` VALUES LESS THAN (2016) ENGINE = InnoDB,
PARTITION `current` VALUES LESS THAN MAXVALUE ENGINE = InnoDB);
My question is, if I run an:
ALTER TABLE mytable
REORGANIZE PARTITION current INTO (
PARTITION p16 VALUES LESS THAN (2017),
...
PARTITION p22 VALUES LESS THAN (2023),
PARTITION future VALUES LESS THAN MAXVALUE);
Will it cause any downtime to the database? This is a HOT production server.
PARTITION
ing is not really a tool meant for improving read performance. Also, 4 million rows is not many rows at all.