August 10, 2007 at 9:51 am
did you update statistics?(see BOL "sp_autostats")
As I stated before, long running queries are often a result of bad statistics.
two servers, even with the same data, can have different statistics (and query plans) due to inserts/updates/queries against the data. since this query would update the entire table the first time it is run, the statistics could be out of whack because of this single update statement. and thus doink any further updates.
is the database option "Auto Create Statistics" turned off? if it is, unless you have a scheduled job to create statistics manually, you will encounter problems like this.
SEE BOL "sp_dboption"
exec sp_dboption 'YOURDBNAME','auto create statistics'
exec sp_dboption 'YOURDBNAME','auto update statistics'
will return your current settings
Lowell
August 10, 2007 at 9:57 am
Yeah Auto Create Statistics is turned on. Cheers. Would the statistics explain why it works the first time and not the second time?
August 13, 2007 at 4:24 am
I've also tried adding
option (maxdop 1)
to the stored procedure which is ran to avoid the parallelism but still the second time it runs it stalls in Exchange and Sleeping.
August 13, 2007 at 8:39 am
can you change your procedure to have the WITH RECOMPILE option in it? that would force it to build a new execution plan, and might fix the issue.
Lowell
August 13, 2007 at 6:42 pm
No explanation except for maybe parallelism, different stats, different number of processors, different section of harddisk, different memory, etc, etc.
It's just not a good idea to update a view of a view (heck, didn't even know that it would work except in very rare cases). It's like doing joined updates without have the target table in the FROM clause... will usually work, but when it doesn't, it'll take hours to resolve.
--Jeff Moden
Change is inevitable... Change for the better is not.
August 24, 2007 at 3:45 am
Yeah that did it. Excellent! Thanks for your help.
Regards
Viewing 6 posts - 16 through 21 (of 21 total)
You must be logged in to reply to this topic. Login to reply