We are experiencing performance issues in the production environment related to the following query.
Which update are recommended here to increase the execution speed.
How can we change where part here without affecting the end result and which help to increase the speed. We have long list of roomid but just added few here. We should consider different roomid based on selected values in UI side.
Required all indexes are added there.
Thanks.
SELECT
si.id
, crc.id
, dr.roomid
, dr.roomname
, d.id
, d.name
, c.id
, c.fullname
FROM
mdl_simplecertificate_issues si
JOIN
mdl_simplecertificate s
ON
si.certificateid = s.id
JOIN
mdl_course c
ON
c.id = s.course
JOIN
mdl_user u
ON
u.id = si.userid
JOIN
mdl_compliance_report_crondata crc
ON
crc.userid = si.userid
AND crc.courseid = s.course
AND crc.courseid = c.id
LEFT JOIN
mdl_department d
ON
d.id = crc.departmentid
AND d.company = crc.companyid
LEFT JOIN
mdl_department_room dr
ON
dr.departmentid = crc.departmentid
AND dr.companyid = crc.companyid
WHERE
(
dr.roomid IN(0
, 1092
, 1124
, 1187
, 1157
, 1159
, 1163
, 1126
, 1180
, 1181
, 620
, 1143
, 948
, 1131
, 1183
, 1052
, 621
, 1177)
OR dr.roomid IS NULL
)