In my previous blog post, we have seen the SQL Server 2016 Sort operator with batch mode processing. To compare the performance for Batch mode versus Row mode for Sort operator, I used a trace flag 9347 which disables the batch mode processing for sort operator. Now the question is: Is there any way to disable the batch mode processing for all the operators (not only for sort operator)? The answer is yes. You people are guessing correct, it’s another trace flag 9453. This trace flag will force the ColumnStore operations to use row mode processing. We can use this trace flag to check the performance impact of row mode processing versus batch mode processing.
Environment details: Here I am using SQL Server 2016 with CU-2. I have created a new database and table. Here the table is partitioned, and I have created a Clustered ColumnStore Index on that. Now let me execute a query that will perform a sort operation.
DBCC DROPCLEANBUFFERS(); GO Select balance,name from xtPartitionTruncate (NOLOCK) WHERE ID<6600000 ORDER BY name GO
From the above output, we can check that time taken is 35 seconds. By default, both operators are using batch mode execution. Let me show you the mode of the operators from the properties of operators (just bring the mouse over the operator).
From the above image you can see that both operators are using batch mode execution. Now we will use trace flag 9453 to force the row mode execution for these operators.
DBCC DROPCLEANBUFFERS(); GO DBCC TRACEON(9453,1) GO Select id,balance,name from xtPartitionTruncate (NOLOCK) WHERE ID<6600000 ORDER BY name GO DBCC TRACEOFF(9453,1) GO
Prince Kumar Rastogi