Feature #100296
closed
Added by Stefan Froemken over 1 year ago.
Updated over 1 year ago.
Description
Hello,
the query of sys_news is not using index. With an index you can "speed up" the query from 0.004 to 0.0005 seconds.
Stefan
- Status changed from New to Under Review
It's this query:
SELECT
`uid`,
`title`,
`content`,
`crdate`
FROM
`sys_news`
WHERE
(
(`sys_news`.`deleted` = 0)
AND (`sys_news`.`hidden` = 0)
AND (
`sys_news`.`starttime` <= 1679690460
)
AND (
(
(`sys_news`.`endtime` = 0)
OR (
`sys_news`.`endtime` > 1679690460
)
)
)
)
ORDER BY
`crdate` DESC;
- Status changed from Under Review to Closed
The columns starttime, endtime, hidden and deleted are in 98% always 0. So the QueryParser decides: reading all data from disc is faster than reading and checking values from index. As no index is used now, it also make no sense to create an index on just crdate.
Also available in: Atom
PDF