In my last post I talked about fixing some of the problems caused when you introduce filtered indexes. In this post I will cover fixing some of the problems caused when you first introduce columnstore indexes to a SQL Server database.
Before we start I’d just like to point out I’m not going to reinvent the wheel here. Niko Neugebauer has a whole series dedicated to columnstore indexes which I talked about in a previous post. In this post I’m going to cover some immediate DBA related issues.
Deadlock creating Columnstore index
Now before everybody panics, I have only ever experienced this issue once. A while back I had to investigate an interesting issue. A large table was being converted from a traditional rowstore (clustered) index to a Clustered Columnstore index. However, when I went to change it to a Clustered Columnstore index it failed with a deadlock error.
I assumed it was due to something else running, I checked and couldn’t see anything. I then went to convert this back to a rowstore (traditional) clustered index. Suprisingly it worked.
But the aim was an table with Clustered Columnstore index. After an double check I ran the create index statement again but this time added an option to set the maxdop to 4. The change still failed with a deadlock error.
Reluctantly, I tried creating a Clustered Columnstore index with the Maxdop set to 1. I knew it would take a while because it was fairly big, but it worked.
Now this was a short term solution to an unusual issue. Long term the solution needed rearchitecting. I just want to make everybody else aware of this unusual issue on the off chance they are ever unfortunate enough to encounter it.
Error due to online statement
It’s a very common error caused usually by somebody copying a rowstore “Create Index” command. The “online=on” option you use with rowstore indexes does not work with creating columnstore indexes yet. For the record the online option will work in SQL Server 2019.
Unsupported Data Types
Another common issue when trying to introduce Columnstore indexes (especially when it involves datawarehouse loads) are failures due to unsupported data types. What I mean are data types you cannot create columnstore indexes on.
One alternative is to keep the table as a rowstore clustered index and try and cover the columns required by a columnstore index. Another option is to get the invalid data types changed. You can view the limitaions with data types for Columnstore indexes here.
I hope you have enjoyed this brief overview. Feel free to comment below if you have any comments or queries.