如题,采用timestamp类型字段分区后执行explain partitions 还是all,全表扫描了
SELECT
partition_name part,
partition_expression expr,
partition_description descr,
table_rows
FROM information_schema.partitions WHERE
table_schema = SCHEMA()
AND table_name='audit_update_status';
显示结果如下:
part expr descr table_rows
p201707 UNIX_TIMESTAMP(update_time) 1501516800 479325
p201708 UNIX_TIMESTAMP(update_time) 1504195200 560409
p201709 UNIX_TIMESTAMP(update_time) 1506787200 80277
执行解释器
EXPLAIN PARTITIONS
SELECT
*
FROM
audit_update_status s
WHERE s.update_time > '2017-07-05 15:31:25'
AND s.update_time < '2017-08-20 15:31:25';
显示结果如下
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE s p201707,p201708,p201709 ALL \N \N \N \N 1102309 Using where