SQL优化:
SQL如下:
SELECT
count(0)
FROM
a
WHERE
a.del_flag = '0'
AND
a.start_time >= '2022-12-01 00:00:00'
AND
a.start_time <= '2022-12-31 24:00:00'
查询时间16秒,怎么能优化下,我加了索引了不管用
求大家帮忙看看
SQL优化:
SQL如下:
SELECT
count(0)
FROM
a
WHERE
a.del_flag = '0'
AND
a.start_time >= '2022-12-01 00:00:00'
AND
a.start_time <= '2022-12-31 24:00:00'
查询时间16秒,怎么能优化下,我加了索引了不管用
采用between。
SELECT
count(0)
FROM
a
WHERE
a.del_flag = '0'
AND
a.start_time between '2022-12-01 00:00:00' AND '2022-12-31 24:00:00'