September 6, 2012 at 6:45 am
Hi,
I recently migrated a database which resided on our old 2005 server to our newer 2008 production server, everything went perfectly well...
...except that one of the stored procedures, which used to run in under a minute now runs constantly without ever completing.
I have tried running the code within the SP directly within a query window within SSMS and the same thing happens. Runs in under a minute on our 2005 instance but never completes on our 2008 instance (exact same source data).
I also tried selecting the two sets of data into temp tables and then joining them together just to see if it would work and it did, the results came back instantly...this made me even more confused!
------------------------------------------
September 6, 2012 at 6:59 am
after an upgrade to a higher version, it's pretty much manditory to rebuild all your statistics;
the statistics in place are used differently by teh updated query engine, so if you skip that step, you can see dramatic performance differencesuntil the statistics are rebuilt.
http://www.sqlservercentral.com/search/?q=slower+after+upgrade
DECLARE @Exec VARCHAR(MAX)
SELECT @Exec = ''
SELECT @Exec = 'UPDATE STATISTICS ' + QUOTENAME(schema_name(schema_id))+ '.' + quotename(name) + ' WITH FULLSCAN ; ' + CHAR(13) + CHAR(10) + @Exec FROM sys.tables ORDER BY name DESC
PRINT LEN(@Exec)
PRINT @Exec
EXEC(@Exec)
Lowell
September 6, 2012 at 7:44 am
Usually "the query runs forever" is db speak for "an index is missing". So I think to diagnose this, we need to know how your database was 'migrated'.
Did you perform a backup and restore? Did you detach the database and reattach? Or did you copy tables using the Import/Export tool?
If you used the last option, I'm almost certain that indexes would not have been created. Usually when I move a database, I perform a backup and restore the backup file to the new system. I then disable access to the original database so we are sure no applications are updating the old system while everybody else is updating the new system.
September 6, 2012 at 10:15 am
My experience has been the same as Ryan's... Indexes not getting moved into prod and they would not be much help without rebuilding your stats as previously mentioned.
Take a look at Considerations for Upgrading the Database Engine (SQL 2008). Specifically the section: After Upgrading the Database Engine
-- Itzik Ben-Gan 2001
September 6, 2012 at 11:02 am
The issue was a result of parameter sniffing, thanks for all your suggestions.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply