EXPLAIN extended
SELECT id, content, content_type, receiver_id, TYPE, function_type, function_id,
read_status, send_time, read_time, STATUS
FROM
xxxtable
WHERE receiver_id = '1667510020'
AND STATUS = 1
AND TYPE = 2
AND send_time < '2017-03-22 08:35:50.553'
AND DATE_SUB(CURDATE(), INTERVAL 12 MONTH ) <= DATE(send_time)
ORDER BY send_time DESC LIMIT 1;
/* select#1 */
select
`xxxxdb`.`xxxxtable`.`id` AS `id`,
`xxxxdb`.`xxxxtable`.`content` AS `content`,
`xxxxdb`.`xxxxtable`.`content_type` AS `content_type`,
`xxxxdb`.`xxxxtable`.`receiver_id` AS `receiver_id`,
`xxxxdb`.`xxxxtable`.`type` AS `TYPE`,
`xxxxdb`.`xxxxtable`.`function_type` AS `function_type`,
`xxxxdb`.`xxxxtable`.`function_id` AS `function_id`,
`xxxxdb`.`xxxxtable`.`read_status` AS `read_status`,
`xxxxdb`.`xxxxtable`.`send_time` AS `send_time`,
`xxxxdb`.`xxxxtable`.`read_time` AS `read_time`,
`xxxxdb`.`xxxxtable`.`status` AS `STATUS`
from
`xxxxdb`.`xxxxtable`
where (
(
`xxxxdb`.`xxxxtable`.`type` = 2
)
and (
`xxxxdb`.`xxxxtable`.`status` = 1
)
and (
`xxxxdb`.`xxxxtable`.`receiver_id` = '1667510020'
)
and (
`xxxxdb`.`xxxxtable`.`send_time` < '2017-03-22 08:35:50.553'
)
and (
< cache > ((curdate() - interval 12 month)) <= cast(
`xxxxdb`.`xxxxtable`.`send_time` as date
)
)
)
order by `xxxxdb`.`xxxxtable`.`send_time` desc
limit 1