Hi there i have an issue with a query that i always run to get some non assigned deliveries.
The query code is:
select suc.SucursalNombre as SucursalDestino , env.FechaRecepcion, CONCAT (env.TipoComprobante, env.NroComprobante) as Comprobante,
env.DomicilioOrigen, env.CodigoPostalOrigen, env.LocalidadOrigen , env.DomicilioDestino, env.CodigoPostalDestino, env.LocalidadDestino,
env.Subtotal, env.Seguro, env.Iva, env.Estado, env.Entregado, env.Cobrado, env.Rendido, hr.HojaRutaID
from envios env
inner join Sucursales suc on suc.SucursalID = env.SucursalIDDestino
left join HojaRutaDetalle hrd on hrd.EnvioID = env.EnvioID
left join HojaRuta hr on hr.HojaRutaID = hrd.HojaRutaID
where env.FechaRecepcion = '20200527' and env.TipoComprobante in ('FA', 'FB', 'RE', 'CP') and hr.HojaRutaID is null
When i run this code usually i get around 100 to 300 records and it last about 3 minutes to run that query...
When i run the Execution Plan i get the following tree...
The Assistant recommends to put an non clustered index so the performance of that query could improve about 16% but i want to do this in about 1 or 2 (or so) seconds like the other querys that i do.
My question is what can i do to improve the performance of that query because i want to learn how to do this but im very new in this area and i dont know how to start...
I hope someone can help me..
Thank you so much in advance.