我有一个calculated_sql,它返回2806行,并在每页50个结果的表上显示。 该calculated_sql由复杂的联接,参数(使该表中的搜索可用)和一个来自客户端的请求所组成。
此calculated_sql加载大约需要1分钟。
是否有任何方法可以提高加载此表的性能?
select c.candidate_id as candidate_id,
c.form_timestamp as form_timestamp,
c.name as name,
c.phone as phone,
c.email as email,
c.location as location,
c.canal as canal,
c.tipo as tipo,
cc.contact_id as contact_id,
cc.contact_date as contact_date,
cc.contact_owner as contact_owner,
cc.status_id as status_id,
cc.status_desc as status_desc,
CONCAT (ifnull(c.form_timestamp, ''), ifnull(c.candidate_id,''), ifnull(c.name,''), ifnull(c.phone,''), ifnull(c.email,''), ifnull(c.location,''), ifnull(c.canal,''), ifnull(c.tipo,''),ifnull(cc.contact_id,''), ifnull(cc.contact_date,''), ifnull(cc.contact_owner,''), ifnull(cc.status_id,''), ifnull(cc.status_desc,'')) as ConcatAll
from candidate c
left join candidate_contacts cc
on c.candidate_id = cc.candidate_id
and (cc.contact_id is null or cc.contact_id in (select ccc.contact_id from candidate_contacts ccc where ccc.contact_id in (select max(contact_id) from candidate_contacts where candidate_id = c.candidate_id)))
where ((c.last_status_id_contact is null and c.last_status_id_interview is null and c.last_status_id_recruit is null)
or (c.last_status_id_contact is not null and c.last_status_id_contact in (select cs.status_id from contact_status cs where cs.action like ('REMAIN'))))
and (c.last_status_id_interview in (select iss.status_id from interview_status iss where iss.action like ('RB2')) or (c.last_status_id_interview is null))
and (
(c.name like concat(CONCAT("%", ifnull(:concatAll,''), "%")))
or (c.phone like concat(CONCAT("%", ifnull(:concatAll,''), "%")))
or (c.location like concat(CONCAT("%", ifnull(:concatAll,''), "%")))
or (c.canal like concat(CONCAT("%", ifnull(:concatAll,''), "%")))
or (c.tipo like concat(CONCAT("%", ifnull(:concatAll,''), "%")))
or (cc.contact_date like concat(CONCAT("%", ifnull(:concatAll,''), "%")))
or (cc.contact_owner like concat(CONCAT("%", ifnull(:concatAll,''), "%")))
or (cc.status_desc like concat(CONCAT("%", ifnull(:concatAll,''), "%")))
or (c.form_timestamp like concat(CONCAT("%", ifnull(:concatAll,''), "%")))
) order by 2 desc;