What would be a good alternative to improve my where clause that currently uses the LEFT function?
Should I create a persisted computed column and an index to it?
SELECT --columns--
FROM DesvioDesenhoSubstitutivoProposto DSP
LEFT JOIN DesvioDesenhoSubstitutivo DS ON DS.idSubstituicaoDesenho = DSP.idSubstituicaoDesenho OUTER APPLY
(SELECT TOP 1 D.Dendis
FROM Interfaces.dbo.SSOLQ068 D
WHERE DS.codigoDesenhoSubstitutivo = LEFT(D.NDISCOMPLFAB, LEN(D.NDISCOMPLFAB)-1)
GROUP BY D.Dendis) AS DESEN
This is the current execution plan for this part:
PS: query has been simplified for posting.