mysql 5.1.73 timestamp分区无效问题 5C

如题,采用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

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问