I have a table with ~200 million rows and ~15 columns in it. I am planning to create the column store index on my table. Will there be any change in performance based on the order of columns that I use in the column store index? If Yes, what is the logic behind it?

有帮助吗?

解决方案

No, it doesn't make any difference.

其他提示

The most important aspect is to add ALL of the columns to the Columnstore index. I spoke to the MSFT product team about this, because I was skeptical about the claim that the 'column order doesn't matter'. But they confirmed that, so long as you add all of the table's columns, this is true.

I also tried partial columnstore indexes (i.e. adding only a subset of columns), while I was able to get the queries I tested to use that columnstore index, clearly the Query Optimizer is not built for this scenario, as the execution plans will be inconsitant and not always optimal, i.e. use columnstore and non-columnstore indices, etc..

No, the column order does not matter, also add all the columns you need to the Column Store Index for all your use cases as there can be only 1 column store index, it will not hurt the performance.

It doesn't.

I just created 2 hours ago a columnstore index for my Fact Table and the query cost (relative to the batch) is now 14% with index and 86% without index. I think it's pretty good. Execution Plan below. You can use "OPTION (IGNORE_NONCLUSTERED_COLUMNSTORE_INDEX)" when you run the query to compare

http://uploadimage.ro/img.php?image=4508_execution_plan_sk6y.png

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top