Have a piece of SQL:
select INSTNUM,'',IDXCOD,INSTFREE,INSTFREE2,YLD
from HIST h where DAT =
(select max(DAT) from HIST h2 where h.INSTNUM = h2.INSTNUM)
go
which runs fine, albeit a bit slow.
An unique clustered index exists for
INSTNUM, DAT
The subquery uses this, the outer query does not.
Just looking for ideas! to speed it up if possible.
select INSTNUM,'',IDXCOD,INSTFREE,INSTFREE2,YLD
from HIST h where DAT =
(select max(DAT) from HIST h2 where h.INSTNUM = h2.INSTNUM)
go
which runs fine, albeit a bit slow.
An unique clustered index exists for
INSTNUM, DAT
The subquery uses this, the outer query does not.
Just looking for ideas! to speed it up if possible.