mysql分区修剪不起作用

mysql分区修剪不起作用,mysql,database-partitioning,pruning,Mysql,Database Partitioning,Pruning,我通过散列(to_days(…)用MySQL分区创建了一个表 但是,当我执行以下查询时。explain partitions结果显示分区修剪不起作用,因为它扫描属于此表的所有分区 explain partitions select count(*) from requestlog where to_days(request_time) = '2012-08-01'; 我尝试了本文中的示例。explain分区仍然显示它扫描所有分区。 如何让分区修剪工作?有什么提示吗?请在不使用的情况下尝试以下

我通过
散列(to_days(…)
用MySQL分区创建了一个表

但是,当我执行以下查询时。
explain partitions
结果显示分区修剪不起作用,因为它扫描属于此表的所有分区

explain partitions select count(*) from requestlog where to_days(request_time) = '2012-08-01';
我尝试了本文中的示例。explain分区仍然显示它扫描所有分区。


如何让分区修剪工作?有什么提示吗?

请在不使用
的情况下尝试以下操作:

explain partitions select count(*) from requestlog where request_time = '2012-08-01';
编辑:


分区修剪在这种情况下有效,但查询本身只返回请求时间为'2012-08-01 00:00:00'的结果,因为您在列
请求时间上有索引。另外,
To_DAYS
函数返回与日期值比较的整数值。分区修剪在此查询中起作用,但结果不正确。例如,此查询忽略其请求时间为“2012-08-01 00:00:01”的数据,请尝试新编辑的查询,或者您也可以使用
DATE(请求时间)=“2012-08-01”
where request\u time between…
where date(request\u time)=…
都将扫描所有分区。我猜MySQL不支持这种分区修剪。
explain partitions select count(*) from requestlog where request_time = '2012-08-01';
explain partitions 
        select count(*) 
        from requestlog 
        where request_time BETWEEN '2012-08-01 00:00:00' AND '2012-08-01 23:59:59';