0
The query below is taking on average 30 seconds to execute. I know that very likely can be the various or and like, but I am searching from the log table and not always the id will be the same, why I used the like. How to 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
With several
LIKE
with%
I don’t think there’s much to improve– Sorack
You can take a look at the answers to this question: https://answall.com/questions/173358/comorbetter-performance-de-leitura-de-um-banco-data
– vinibrsl
@Renanbessa: I could add, in the description of the question, information like : (1) What is the purpose of the query? (2) What contains and how is the LOGDESCRICAO column structured? // I found strange the use of % in the middle of the sequences. // The sequences must be searched along the content of LOGDESCRICAO or from the beginning?
– José Diz