I have a query that is very slow and I wanted to see how it can be improved. Currently there is an installed SQL SERVER 2008 R2 express edition the query is this
select top 9999999
albfacca.can,albfacca.ejealb,albfacca.numalb,albfacca.fecalb,
clientes.nom,albfacca.suped,
albfacca.totfac,
albfacca.webnum,albfacca.actfac,albfacca.idrecno
from albfacca
left join clientes on clientes.codcli=albfacca.codcli
where 1=1 and albfacca.can='B '
order by fecalb DESC,ALBFACCA.IDRECNO DESC
The albfacca table has 94000 records. 140 fields The customer table has 700 records. 80 fields
the tables are correctly indexed.
this query takes at least 15 seconds
Can it be improved? How?