|
Posted by Erland Sommarskog on 05/25/05 23:39
(wireless200@yahoo.com) writes:
> Should the join run very slowly? If I do the insert with a standard
> insert query it takes about 7 minutes. With the join query it runs and
> doesn't seem to be able to finish. If I run the query on dates with no
> data it finishes ok. Is my join incorrect since I can't use S.keyrow?
I don't understand that last question. What do you mean, you cannot
use S.keyrow?
A clustered index on S.record_date would be a good thing.
I would also replace the LEFT JOIN with NOT EXISTS. Not because this
is faster, but because expresses what you mean.
Does the target table have an IDENTITY column? Else there is no reason at
all to have the ORDER BY clause. Removing that could also gain some
performance.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp
Navigation:
[Reply to this message]
|