following query is causing high cpu utilization on db is there any help to re write this query to improve the performance of this query.
SELECT
de.infgrdt,
de.hfg,
de.dfg,
de.hjr,
e.ufl as exchange,
de.efxd,
t.jdnm AS prkr
FROM mnvb.hjvgf de
JOIN mnvb.yefg e ON (de.efxd = e.fgd)
JOIN mnvb.fjtn t ON (de.gefvb = t.fgd)
WHERE de.infgrdt >= '2022-10-14 00:04:20.000000' AND de.infgrdt < '2022-10-14 03:22:54.000000';
CodePudding user response:
These may help some:
de: INDEX(infgrdt) -- you already have this
e: INDEX(fgd, ufl)
t: INDEX(fgd, jdnm)
The last two are "covering", which gives a slight performance boost.
For further investigation, please provide
SHOW CREATE TABLE ...
EXPLAIN SELECT ...