We have a data warehouse that we recently upgraded to 2014 (Enterprise).
Since the upgrade we are experiencing enormous compile times on most of our queries (2014 compatibility level only). Requesting an estimated execution plan can take up to half an hour where before it was as good as instantaneous. The execution time of queries
improved in general by 30% but the long compilation times make this improvement useless.
We are experimenting with trace flags 2312/9481 to enable/disable the new CE and tweaking queries to figure out where the increase in time comes from. So far no success. If we disable the CE, compilation is fine, enabled, it is not.
Our statistics are up to date, indexes are in place and defragged, the databases are reasonably large (1-2 TB) and use a few column stores for fact-like tables. A typical query will use around 30 tables. We have identified some groups of tables with more or less the same cardinality. Our current theory is that SQL is trying to estimate each possible path (i.e. order of tables, join type, etc).
Our queries are generated and therefore we cannot influence them easily. They are also mostly unique. The queries use simple inner joins and the execution times are really good. It is the compilation time that is the problem.
So our question is basically, how can we influence the new CE/compiler in any way to;
- Have a maximum time to evaluate paths, i.e., be happy with a simpler plan if the better one takes forever to deduce.
- Figure out if there is any part of our queries (or structures) in particular that could be causing the problem.
- Figure out if there is a particular part of the query or phase of the compiler that is consuming the time.
Our "solution" at this moment is to disable the new cardinality estimator.
Any help is appreciated.
Cheers,
Michel