The query below takes an average of 30 seconds to execute. I know that most likely it will be the various or and like , but I am looking for the log table and not always the id will be the same, for I used the like . How do I adjust this query to become faster?
select max(l.logdescricao),
S.SolID [N° Chamado],
S.NomeCliente [Nome Cliente],
MAX(T.TraData) [Data do Último Trâmite],
U.UsuNome [Consultor Responsável]
from Solicitacao S
inner join Log L on S.SolID = L.LogSolID
LEFT JOIN Usuario U
ON U.UsuID = S.UsuIDResponsavel
LEFT JOIN Tramite T
ON T.SolID = S.SolID
left join StatusMotivo SM ON SM.SMSolID = S.SolID
where S.VencimentoPausado = 0 and S.SolStatus <> 9 and (L.LOGDESCRICAO like '%16357%Aguardando%Operadora%' or L.LOGDESCRICAO like '%1061%Aguardando%Cliente%'
or L.LOGDESCRICAO like '%1061%Aguardando%Desenvolvimento%' or L.LOGDESCRICAO like '%1061%Aguardando%Operadora%')
group by S.SolID,S.NomeCliente,U.UsuNome