1.有一张心跳表 tb_heartbeat ( id int, tid varchar(64), hbTime dateTime); 2.保存最近七天的数据,每天凌晨删除七天前的数据 3.创建按星期几的分区(为了不频繁创建和 drop 分区)。 ALTER TABLE tb_heartbeat PARTITION BY RANGE(WEEKDAY(hbTime))( PARTITION p1 VALUES less than (1), PARTITION p2 VALUES less than (2), PARTITION p3 VALUES less than (3), PARTITION p4 VALUES less than (4), PARTITION p5 VALUES less than (5), PARTITION p6 VALUES less than (6), PARTITION p7 VALUES less than (MAXVALUE) ); 4.但是在删除某一天的数据,它会遍历所有分区。 EXPLAIN PARTITIONS DELETE from tb_heartbeat where hbtime < '2019-08-29 23:59:59' and hbtime > '2019-08-29 00:00:00' 会遍历 partitions:p1,p2,p3,p4,p5,p6,p7 5.这里关于分区裁剪是没效果吗? 谢谢