Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 15264

High compile time SQL Server 2012 v 2008

$
0
0

We are in the process of testing the upgrade of our SQL Server 2008 database to 2012. We have found there are a number of queries that are performing significantly slower after the upgrade.

We have tracked this down to very high compilation times on 2012. The hardware is identical and the databases are identical, other than one being upgraded.

For example, for a particular query on 2008 we see:

  SQL Server parse and compile time:
 
  CPU time = 156 ms, elapsed time = 157 ms.

and the exact same query on 2012 we see:

  SQL Server parse and compile time:
 
  CPU time = 6708 ms, elapsed time = 7249 ms.

Unfortunately I haven't been able to produce a simple example to reproduce this problem, so I can't post it here.

What we have found is that there is one particular comparison in the WHERE clause that seems to trigger this behaviour. It is a >= applied to a date column e.g.: 

  WHERE P.FIRST_DATE>='1998-Jan-01'

performs very slowly.

In this case the date is well before the first date actual present in the table in question.

If we modify the query to use the first date actually present, the performance returns to that on 2008 .e.g:

  WHERE P.FIRST_DATE>='2013-Jan-01'

performs quickly.

(Possibly) interestingly, if the identical query is re-submitted it is compiled again i.e. the plan isn't being cached.

Has anyone come across this problem before?

Thanks
Daniel


Viewing all articles
Browse latest Browse all 15264

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>