Fast in SQL 2008 and slow in SQL 2012

  • I have a statement like:

    SELECT * FROM MyTable WHERE NOT PrimaryKey IN (SELECT Keys FROM #MyTempTable)

    IN SQL 2008, this statement was running in less than one minute on a pretty large database that has been migrated to SQL 2012. Now, the statement takes nearly half an hour to execute.

    Any suggestions?

  • Did you update statistics when you upgraded? I'm betting that you didn't. Run a manual UPDATE STATISTICS against the table(s) in question and see if the query performance improves.

    Regards

    Lempster

  • Check the execution plan for both. See what's being generated by the optimizer. That will help you understand if there is something mundane like statistics at fault, or if you're dealing with a regression.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Did you check for blocking?? People forget that concurrent activity can stop SELECTs in their tracks for extended periods sometimes.

    Best,
    Kevin G. Boles
    SQL Server Consultant
    SQL MVP 2007-2012
    TheSQLGuru on googles mail service

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply