Warning: Constant WP_TEMP_DIR already defined in /var/www/html/blogs/joe/wp-config.php on line 93

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/blogs/joe/wp-config.php:93) in /var/www/html/blogs/joe/wp-includes/rest-api/class-wp-rest-server.php on line 1902
{"id":998,"date":"2013-05-05T04:52:51","date_gmt":"2013-05-05T11:52:51","guid":{"rendered":"http:\/\/3.209.169.194\/blogs\/joe\/?p=998"},"modified":"2013-05-05T04:56:04","modified_gmt":"2013-05-05T11:56:04","slug":"exploring-columnstore-index-batch-sizes","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/joe\/exploring-columnstore-index-batch-sizes\/","title":{"rendered":"Exploring Columnstore Index Batch Sizes"},"content":{"rendered":"

In this blog post we\u2019ll explore columnstore index batch execution mode limits.\u00a0 I\u2019m using SQL Server 2012 Developer Edition, version 11.0.3349 (SP1, CU3).<\/p>\n

To start off with, I\u2019ll create a table that uses six different supported nonclustered columnstore index data types:<\/p>\n

\r\nUSE [CS];\r\nGO\r\n\r\nCREATE TABLE dbo.[FactContrived]\r\n(\r\ncol00 TINYINT NOT NULL DEFAULT 255,\r\ncol01 SMALLINT NOT NULL DEFAULT 32767,\r\ncol02 INT NOT NULL DEFAULT 2147483647,\r\ncol03 BIGINT NOT NULL DEFAULT 9223372036854775807,\r\ncol04 SMALLMONEY NOT NULL DEFAULT 214748.3647,\r\ncol05 MONEY NOT NULL DEFAULT 922337203685477.5807);\r\nGO\r\n<\/pre>\n

I\u2019ll populate this table with 1,048,576 rows, all using the same value for each row (contrived by-design):<\/p>\n

\r\nSET NOCOUNT ON;\r\nGO\r\n\r\nINSERT dbo.[FactContrived]\r\nDEFAULT VALUES;\r\nGO\r\n\r\nINSERT dbo.[FactContrived]\r\nSELECT\u00a0 [col00],\r\n[col01],\r\n[col02],\r\n[col03],\r\n[col04],\r\n[col05]\r\nFROM dbo.[FactContrived];\r\nGO 20\r\n <\/pre>\n

Next I\u2019ll create a nonclustered columnstore index on each column in the table:<\/p>\n

\r\nCREATE NONCLUSTERED COLUMNSTORE INDEX [NCI_FactContrived]\r\nON dbo.[FactContrived]\r\n([col00], [col01], [col02], [col03], [col04], [col05] )\r\nWITH (MAXDOP = 1);\r\nGO\r\n<\/pre>\n

Once created, I\u2019ll check the page count statistics with the following query:<\/p>\n

\r\nSELECT\u00a0 [partition_id],\r\nSUM([in_row_used_page_count]) AS [in_row_used_page_count],\r\nSUM([lob_used_page_count]) AS [lob_used_page_count],\r\nSUM([row_count]) AS [row_count]\r\nFROM\u00a0\u00a0\u00a0 sys.[dm_db_partition_stats]\r\nWHERE\u00a0\u00a0 [object_id] = OBJECT_ID('FactContrived') AND\r\n[index_id] = INDEXPROPERTY\r\n(OBJECT_ID('FactContrived'),\r\n'NCI_FactContrived',\r\n'IndexId')\r\nGROUP BY [partition_id];\r\nGO\r\n<\/pre>\n

This query returns the following results:<\/p>\n

\"image\"<\/a><\/p>\n

So as expected, the nonclustered columnstore index is stored within LOB pages (1,050 total).<\/p>\n

Next I\u2019ll check the segment metadata for the specific partition_id:<\/p>\n

 \r\nSELECT\r\n[column_id],\r\n[segment_id],\r\n[encoding_type],\r\n[row_count],\r\n[primary_dictionary_id],\r\n[secondary_dictionary_id],\r\n[min_data_id],\r\n[max_data_id],\r\n[on_disk_size]\r\nFROM\u00a0\u00a0\u00a0 sys.[column_store_segments]\r\nWHERE [partition_id] = 72057594039762944;\r\n<\/pre>\n

This returns the following 7 rows:<\/p>\n

\"image\"<\/a><\/p>\n

Observations on this output:<\/p>\n