Why The Difference In Speed?
From: chris (anonymous_at_discussions.microsoft.com)
Date: 04/04/04
- Next message: Dylan: "Number to Date."
- Previous message: Vishal Parkar: "Re: Missing SELECT statement, but where??"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 3 Apr 2004 17:18:11 -0800
Hello.
If I perform this query:
UPDATE table1 SET field1='Y'
WHERE field1 IN (SELECT field1 FROM table2
WHERE id > 0 AND id < 100);
...it takes a second at most
If I perform this query:
UPDATE table1 SET field1='Y'
WHERE field1 IN (SELECT field1 FROM table2
WHERE id > @counter AND id <
@counter+100);
...it takes an eternity.
Basically, I want to do a loop and update a table from
another table. I've found that if I do the updates using
smaller select chunks from the second table it is much
faster.
Any help appreciated.
Chris.
- Next message: Dylan: "Number to Date."
- Previous message: Vishal Parkar: "Re: Missing SELECT statement, but where??"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|