Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15694

Columnstore poor optimization (row mode)

$
0
0

Hi all,

I am tearing my hair out with the poor optimization that exists with columnstore indexes.  As many have pointed out in the past, running something like:

SELECT SUM(Measure) FROM FactTable

is far slower than

SELECT SUM(Measure) FROM (SELECT SUM(Measure) AS Measure FROM FactTable GROUP BY Date) Report

The reason is, with a GROUP BY statement, the optimizer picks batch mode rather than row mode, which has an incredible impact on performance.  My first question is, why on earth?  Surely, the optimizer could use statistics to pick the lowest cardinality column or columns in the index and use that in batch mode, then do the aggregation for me.

Secondly, this poses a major problem for us in using columnstore.  Currently, we're using Analysis Services and ROLAP to query the underlying source.  It ends up that putting things like "Date" on one of the axes as opposed to in the where slice is magnitudes faster, and really reduces the ability of using columnstore and Analysis Services together.

Is Microsoft planning a fix for this, and if so, when?  If not, how could you workaround this to force the query optimizer to pick batch mode?

It's quite frustrating seeing such great performance when it gets it right (i.e. uses batch mode), but no way to specify a hint or override the optimizer's poor choices.


Viewing all articles
Browse latest Browse all 15694

Trending Articles



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