{"id":4996,"date":"2015-06-20T19:25:55","date_gmt":"2015-06-20T17:25:55","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\/"},"modified":"2015-06-20T19:25:55","modified_gmt":"2015-06-20T17:25:55","slug":"sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\/","title":{"rendered":"SQL Server 2016 : availability groups and the new clustered columnstore index support"},"content":{"rendered":"<p>This blog post is focused on the new supportability of clustered columnstore index on the high- availability read-only replicas.<\/p>\n<p>Others studies are available here:<\/p>\n<ul>\n<li><a href=\"\/sql-server-2016-availability-groups-and-the-new-option-dbfailover-\" target=\"_blank\" rel=\"noopener noreferrer\">New database issue level detection for automatic failover<\/a><\/li>\n<li><a href=\"\/sql-server-2016-native-support-for-json\" target=\"_blank\" rel=\"noopener noreferrer\">Potential features in standard edition<\/a><\/li>\n<li><a href=\"\/sql-server-2016-availability-groups-and-automatic-failover-enhancements\" target=\"_self\" rel=\"noopener noreferrer\">Automatic failover enhancements<\/a><\/li>\n<li><a href=\"\/sql-server-2016-availability-groups-and-load-balancing-features\" target=\"_self\" rel=\"noopener noreferrer\">New load balancing features with read-only replicas<\/a><\/li>\n<\/ul>\n<p>After reading some improvements from the columnstore index feature side, I was very surprised to see the following section:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog_53_-_1-_cci_new_features.jpg\" alt=\"blog_53_-_1-_cci_new_features\" width=\"648\" height=\"104\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Clustered columnstore indexes are now supported on AlwaysOn readable secondary replicas! Wonderful! And I guess that the new support of both SI and RCSI transaction isolation level have something to do with this improvement.<\/p>\n<p>So let\u2019s create a clustered columnstore index on my lab environment. I will use for my tests the <em>AdventureWorksDW2012<\/em> database and the <em>FactProductInventory <\/em>fact table.<\/p>\n<p>A first look at this fact table tells us that we\u2019ll probably face an error message because this table contains some foreign keys and one primary key that are not supported on SQL Server 2014. Fortunately, SQL Server 2016 has no such limitations and we\u2019ll able to create the clustered columnstore index.<\/p>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: maroon\">sp_helpconstraint<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: red\">&#8216;dbo.FactProductInventory&#8217;<span style=\"color: gray\">;<\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">go<\/span><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog_53_-_2-_cci_fk_pk.jpg\" alt=\"blog_53_-_2-_cci_fk_pk\" width=\"669\" height=\"74\" \/><\/p>\n<p>We can notice two foreign keys and one primary key. The latter is clustered so before creating the clustered columnstore, I will have to change the primary key to a unique constraint.<\/p>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: green\">&#8212; drop primary key<\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">alter<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: blue\">table dbo<span style=\"color: gray\">.FactProductInventory<\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">drop<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: blue\">constraint PK_FactProductInventory<span style=\"color: gray\">;<\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">go<\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0<\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: green\">&#8212; create CCI<\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">create<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: blue\">clustered <span style=\"color: blue\">columnstore <span style=\"color: blue\">index idx_cci_FactProductInventory<\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">on<span style=\"font-size: 9.5pt;font-family: Consolas\"> FactProductInventory<\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0<\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: green\">&#8212; create unique constraint on ProductKey, DateKey columns<\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">alter<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: blue\">table dbo<span style=\"color: gray\">.FactProductInventory<\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">add<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: blue\">constraint PK_FactProductInventory <span style=\"color: blue\">unique <span style=\"color: gray\">(ProductKey<span style=\"color: gray\">, DateKey<span style=\"color: gray\">);<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">go<\/span><\/div>\n<p>&nbsp;<\/p>\n<p>Let\u2019s add 2 rows in the <em>dbo.FactProductInventory<\/em> \u2026<\/p>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">insert<span style=\"font-size: 9.5pt;font-family: Consolas\"> [AdventureWorksDW2012]<span style=\"color: gray\">.[dbo]<span style=\"color: gray\">.[FactProductInventory]<\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">values <span style=\"font-size: 9.5pt;font-family: Consolas;color: gray\">(<span style=\"font-size: 9.5pt;font-family: Consolas\">167<span style=\"color: gray\">, <span style=\"color: red\">&#8216;20090101&#8217;<span style=\"color: gray\">, <span style=\"color: red\">&#8216;2009-01-01&#8217;<span style=\"color: gray\">, 0.19<span style=\"color: gray\">, 0<span style=\"color: gray\">, 0<span style=\"color: gray\">, 875<span style=\"color: gray\">)<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0<\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">insert<span style=\"font-size: 9.5pt;font-family: Consolas\"> [AdventureWorksDW2012]<span style=\"color: gray\">.[dbo]<span style=\"color: gray\">.[FactProductInventory]<\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">values <span style=\"font-size: 9.5pt;font-family: Consolas;color: gray\">(<span style=\"font-size: 9.5pt;font-family: Consolas\">167<span style=\"color: gray\">, <span style=\"color: red\">&#8216;20091002&#8217;<span style=\"color: gray\">, <span style=\"color: red\">&#8216;2009-01-02&#8217;<span style=\"color: gray\">, 0.19<span style=\"color: gray\">, 0<span style=\"color: gray\">, 0<span style=\"color: gray\">, 875<span style=\"color: gray\">)<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/div>\n<p>\u2026 and let\u2019s take a look at this columstore index configuration:<\/p>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">select<\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 partition_number<span style=\"color: gray\">,<\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 state_description<span style=\"color: gray\">,<\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: fuchsia\">count<span style=\"color: gray\">(*) <span style=\"color: blue\">as nb_row_groups<span style=\"color: gray\">,<\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: fuchsia\">sum<span style=\"color: gray\">(total_rows<span style=\"color: gray\">) <span style=\"color: blue\">as total_rows<span style=\"color: gray\">,<\/span><\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: fuchsia\">sum<span style=\"color: gray\">(size_in_bytes<span style=\"color: gray\">) <span style=\"color: gray\">\/ 1024 <span style=\"color: gray\">\/ 1024 <span style=\"color: blue\">as size_mb<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">from<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: green\">sys<span style=\"color: gray\">.column_store_row_groups<\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">where<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: fuchsia\">object_id <span style=\"color: gray\">= <span style=\"color: fuchsia\">object_id<span style=\"color: gray\">(<span style=\"color: red\">&#8216;dbo.FactProductInventory&#8217;<span style=\"color: gray\">)<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">group<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: blue\">by partition_number<span style=\"color: gray\">, state_description<\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">order<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: blue\">by partition_number<span style=\"color: gray\">, state_description<span style=\"color: gray\">;<\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">go<\/span><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog_53_-_3-_cci_rowgroups.jpg\" alt=\"blog_53_-_3-_cci_rowgroups\" width=\"442\" height=\"58\" \/><\/p>\n<p>Finally let\u2019s add this <em>AdventureWorks2012DW<\/em> database to my availability group named 2016Grp:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog_53_-_4-_cci_aag.jpg\" alt=\"blog_53_-_4-_cci_aag\" width=\"265\" height=\"219\" \/><\/p>\n<p>Now, let\u2019s try to query my columnstore index on the SQL162 replica configured as secondary read-only replica:<\/p>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">select<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: fuchsia\">@@servername <span style=\"color: blue\">as server_name<span style=\"color: gray\">;<\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">go<\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0<\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">select<span style=\"font-size: 9.5pt;font-family: Consolas\"> ProductKey<span style=\"color: gray\">, <span style=\"color: fuchsia\">max<span style=\"color: gray\">(DateKey<span style=\"color: gray\">)<\/span><\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">from<span style=\"font-size: 9.5pt;font-family: Consolas\"> [AdventureWorksDW2012]<span style=\"color: gray\">.[dbo]<span style=\"color: gray\">.[FactProductInventory]<\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">where<span style=\"font-size: 9.5pt;font-family: Consolas\"> ProductKey <span style=\"color: gray\">= 167<\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">group<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: blue\">by ProductKey<span style=\"color: gray\">;<\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">go<\/span><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog_53_-_5-_cci_query.jpg\" alt=\"blog_53_-_5-_cci_query\" width=\"233\" height=\"97\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Do you remember this error message with SQL Server 2014?<\/p>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal\"><em><span style=\"font-size: 9pt;font-family: Consolas;color: red\">Msg 35371, Level 16, State 1, Line 120<\/span><\/em><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal\"><em><span style=\"font-size: 9pt;font-family: Consolas;color: red\">SNAPSHOT isolation level is not supported on a table which has a clustered columnstore index.<\/span><\/em><\/div>\n<p>With SQL Server 2016 it seems to be another story and it appears to be working properly and this is because snapshot is now supported for clustered columnstore indexes. Let\u2019s have a look at the result of the following query:<\/p>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">select<\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 st<span style=\"color: gray\">.session_id<span style=\"color: gray\">,<\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 st<span style=\"color: gray\">.is_user_transaction<span style=\"color: gray\">,<\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 tat<span style=\"color: gray\">.transaction_id<span style=\"color: gray\">,<\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 tat<span style=\"color: gray\">.transaction_sequence_num<span style=\"color: gray\">,<\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 tat<span style=\"color: gray\">.is_snapshot<\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">from<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: green\">sys<span style=\"color: gray\">.<span style=\"color: green\">dm_tran_active_snapshot_database_transactions <span style=\"color: blue\">as tat<\/span><\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: gray\">join<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: green\">sys<span style=\"color: gray\">.<span style=\"color: green\">dm_tran_session_transactions <span style=\"color: blue\">as st<\/span><\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: blue\">on tat<span style=\"color: gray\">.transaction_id <span style=\"color: gray\">= st<span style=\"color: gray\">.transaction_id<\/span><\/span><\/span><\/span><\/span><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog_53_-_6-_cci_tran.jpg\" alt=\"blog_53_-_6-_cci_tran\" width=\"520\" height=\"42\" \/><\/p>\n<p>The session with id = 65 concerns my query here. We may notice that it is using snapshot without specifying anything transaction isolation level parameter from my side. As a reminder all read-only queries on a secondary replica are automatically overridden to snapshot isolation and row version mechanism to avoid blocking contention.<\/p>\n<p>But I\u2019m also curious to know if we will face the same blocked redo thread issue in this case? As you know, snapshot isolation prevents read-only queries on the secondary replicas from taking locks and preventing other DML statements against the database from executing, but it doesn\u2019t prevent the read-only queries from taking schema stability locks and blocking DDL statements.<\/p>\n<p>So I wondered if operations issued by the tuple mover in order to switch data from delta store to a row group could stuck the redo thread from executing correctly. To create such situation we may use a long running query on the columnstore index from the secondary replica and in the same time we may insert sufficient data to close a delta store from the primary replica.<\/p>\n<p>Here my horrible and inefficient query that I executed from the secondary. The idea is to hold a schema stability lock during my test.<\/p>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: green\">&#8212; from the secondary replica<\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">select<span style=\"font-size: 9.5pt;font-family: Consolas\"> c<span style=\"color: gray\">.ProductKey<span style=\"color: gray\">, <span style=\"color: fuchsia\">max<span style=\"color: gray\">(c<span style=\"color: gray\">.DateKey<span style=\"color: gray\">)<\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">from<span style=\"font-size: 9.5pt;font-family: Consolas\"> [AdventureWorksDW2012]<span style=\"color: gray\">.[dbo]<span style=\"color: gray\">.[FactProductInventory] <span style=\"color: blue\">as c<\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: gray\">cross<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: gray\">join [AdventureWorksDW2012]<span style=\"color: gray\">.[dbo]<span style=\"color: gray\">.[FactProductInventory] <span style=\"color: blue\">as c2<\/span><\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: gray\">cross<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: gray\">join [AdventureWorksDW2012]<span style=\"color: gray\">.[dbo]<span style=\"color: gray\">.[FactProductInventory] <span style=\"color: blue\">as c3<\/span><\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">group<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: blue\">by c<span style=\"color: gray\">.ProductKey<span style=\"color: gray\">;<\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">go<\/span><\/div>\n<p>And the locks hold by my query:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog_53_-_7-_ro_query_locks.jpg\" alt=\"blog_53_-_7-_ro_query_locks\" width=\"776\" height=\"114\" \/><\/p>\n<p>Then I inserted sufficient data to close my delta store:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog_53_-_8-_cci_delta_store_closed.jpg\" alt=\"blog_53_-_8-_cci_delta_store_closed\" width=\"638\" height=\"45\" \/><\/p>\n<p>After calling manually the tuple mover by using the ALTER INDEX REORGANIZE command, I didn\u2019t face a blocking redo thread situation.<\/p>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: green\">&#8212; from secondary replica<\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">use<span style=\"font-size: 9.5pt;font-family: Consolas\"> AdventureWorksDW2012<\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">go<\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0<\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">select<\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 r<span style=\"color: gray\">.replica_server_name<span style=\"color: gray\">,<\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 g<span style=\"color: gray\">.name <span style=\"color: blue\">as aag_name<span style=\"color: gray\">,<\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 drs<span style=\"color: gray\">.synchronization_state_desc <span style=\"color: blue\">as replica_state<span style=\"color: gray\">,<\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 drs<span style=\"color: gray\">.synchronization_health_desc <span style=\"color: blue\">as synchro_state<span style=\"color: gray\">,<\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 drs<span style=\"color: gray\">.redo_queue_size<\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">from<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: green\">sys<span style=\"color: gray\">.dm_hadr_database_replica_states <span style=\"color: blue\">as drs<\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: gray\">join<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: green\">sys<span style=\"color: gray\">.availability_replicas <span style=\"color: blue\">as r<\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: blue\">on r<span style=\"color: gray\">.replica_id <span style=\"color: gray\">= drs<span style=\"color: gray\">.replica_id<\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: gray\">join<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: green\">sys<span style=\"color: gray\">.availability_groups <span style=\"color: blue\">as g<\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: blue\">on g<span style=\"color: gray\">.group_id <span style=\"color: gray\">= drs<span style=\"color: gray\">.group_id<\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">where<span style=\"font-size: 9.5pt;font-family: Consolas\"> g<span style=\"color: gray\">.name <span style=\"color: gray\">= <span style=\"color: red\">&#8216;2016Grp&#8217;<\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: gray\">and drs<span style=\"color: gray\">.database_id <span style=\"color: gray\">= <span style=\"color: fuchsia\">DB_ID<span style=\"color: gray\">();<\/span><\/span><\/span><\/span><\/span><\/span><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog_53_-_9-_cci_redo_size_queue.jpg\" alt=\"blog_53_-_9-_cci_redo_size_queue\" width=\"506\" height=\"42\" \/><\/p>\n<p>In fact, we can expect to this result because according to the Microsoft documentation, ALTER INDEX REORGANIZE statement is always performed online. This means long-term blocking table locks are not held and queries or updates to the underlying table can continue during this operation.<\/p>\n<p>So the new situation is the following on both replicas:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog_53_-_10-_cci_reorganize.jpg\" alt=\"blog_53_-_10-_cci_reorganize\" width=\"668\" height=\"65\" \/><\/p>\n<p>Note the new delta store state TOMBSTONE here. I got some information from the Niko Neugebauer (<a href=\"https:\/\/twitter.com\/NikoNeugebauer\">@NikoNeugebauer<\/a>) blog post <a href=\"http:\/\/www.nikoport.com\/2014\/12\/12\/azure-columnstore-1-the-initial-preview-offering\/\">here<\/a>. In fact row group in TOMBSTONE state are delta stores that got compressed (row_group_id = 16 to row_group_id = 18 in my context). This unused row group will be dropped asynchronously by the garbage collector by the tuple mover.<\/p>\n<p>Finally, let\u2019s try to rebuild my columnstore index. In this case we may expect to be in a situation where the redo thread will be blocked by this DDL operation.<\/p>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: green\">&#8212; from the primary replica<\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">alter<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: blue\">index [idx_cci_FactProductInventory]<\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">on<span style=\"font-size: 9.5pt;font-family: Consolas\"> [dbo]<span style=\"color: gray\">.[FactProductInventory]<\/span><\/span><\/span><\/div>\n<p>Let\u2019s take a look at the redo queue from my secondary replica:<\/p>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: green\">&#8212; from secondary replica<\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">use<span style=\"font-size: 9.5pt;font-family: Consolas\"> AdventureWorks2012DW<\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">go<\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0<\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">select<\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 r<span style=\"color: gray\">.replica_server_name<span style=\"color: gray\">,<\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 g<span style=\"color: gray\">.name <span style=\"color: blue\">as aag_name<span style=\"color: gray\">,<\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 drs<span style=\"color: gray\">.synchronization_state_desc <span style=\"color: blue\">as replica_state<span style=\"color: gray\">,<\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 drs<span style=\"color: gray\">.synchronization_health_desc <span style=\"color: blue\">as synchro_state<span style=\"color: gray\">,<\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 drs<span style=\"color: gray\">.redo_queue_size<\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">from<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: green\">sys<span style=\"color: gray\">.dm_hadr_database_replica_states <span style=\"color: blue\">as drs<\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: gray\">join<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: green\">sys<span style=\"color: gray\">.availability_replicas <span style=\"color: blue\">as r<\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: blue\">on r<span style=\"color: gray\">.replica_id <span style=\"color: gray\">= drs<span style=\"color: gray\">.replica_id<\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: gray\">join<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: green\">sys<span style=\"color: gray\">.availability_groups <span style=\"color: blue\">as g<\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: blue\">on g<span style=\"color: gray\">.group_id <span style=\"color: gray\">= drs<span style=\"color: gray\">.group_id<\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">where<span style=\"font-size: 9.5pt;font-family: Consolas\"> g<span style=\"color: gray\">.name <span style=\"color: gray\">= <span style=\"color: red\">&#8216;2016Grp&#8217;<\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 <span style=\"color: gray\">and drs<span style=\"color: gray\">.database_id <span style=\"color: gray\">= <span style=\"color: fuchsia\">DB_ID<span style=\"color: gray\">();<\/span><\/span><\/span><\/span><\/span><\/span><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog_53_-_11-_ro_blocked_redo_thread.jpg\" alt=\"blog_53_-_11-_ro_blocked_redo_thread\" width=\"506\" height=\"42\" \/><\/p>\n<p>This time, the ALTER INDEX REBUILD operation has a negative effect on the redo thread which is now stuck while the reporting query execution.<\/p>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: green\">&#8212; from the secondary replica<\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">select<span style=\"font-size: 9.5pt;font-family: Consolas\"> session_id<span style=\"color: gray\">, <\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 command<span style=\"color: gray\">, <\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 blocking_session_id<span style=\"color: gray\">, <\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 wait_time<span style=\"color: gray\">, <\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 wait_type<span style=\"color: gray\">, <\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas\">\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 wait_resource<\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">from<span style=\"font-size: 9.5pt;font-family: Consolas\"> <span style=\"color: green\">sys<span style=\"color: gray\">.<span style=\"color: green\">dm_exec_requests <\/span><\/span><\/span><\/span><\/span><\/div>\n<div style=\"margin-bottom: 0.0001pt;line-height: normal;background: #d9d9d9 none repeat scroll 0% 0%\"><span style=\"font-size: 9.5pt;font-family: Consolas;color: blue\">where<span style=\"font-size: 9.5pt;font-family: Consolas\"> command <span style=\"color: gray\">= <span style=\"color: red\">&#8216;DB STARTUP&#8217;<\/span><\/span><\/span><\/span><\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog_53_-_12-_ro_blocked_redo_thread_2.jpg\" alt=\"blog_53_-_12-_ro_blocked_redo_thread_2\" width=\"626\" height=\"69\" \/><\/p>\n<p>The blocking session concerns my reporting query here:<\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"text-decoration: underline\">The bottom line<\/span><\/p>\n<p><span style=\"font-size: 11pt;line-height: 107%;font-family: 'Calibri',sans-serif\">Introducing the new clustered columnstore index in AlwaysOn availability groups will be definitively a good improvement in several aspects. Indeed, even if clustered columnstore indexes are designed to save a lot of resources, it is always interesting to benefit this feature to offload reporting activities in some scenarios. Moreover, it will be also a good answer to the existing lack of both SI and RCSI transaction isolation levels and the reporting data consistency without locking. I\u2019m looking forward to see these both features in action in production environments soon!<\/span><\/p>\n<p>By David Barbarin<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This blog post is focused on the new supportability of clustered columnstore index on the high- availability read-only replicas. Others studies are available here: New database issue level detection for automatic failover Potential features in standard edition Automatic failover enhancements New load balancing features with read-only replicas After reading some improvements from the columnstore index [&hellip;]<\/p>\n","protected":false},"author":26,"featured_media":4997,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[199],"tags":[466,297,579,566],"type_dbi":[],"class_list":["post-4996","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-hardware-storage","tag-alwayson","tag-availability-groups","tag-column-store","tag-sql-server-2016"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>SQL Server 2016 : availability groups and the new clustered columnstore index support - dbi Blog<\/title>\n<meta name=\"description\" content=\"SQL Server 2016 : availability groups and the new clustered columnstore index support\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Server 2016 : availability groups and the new clustered columnstore index support\" \/>\n<meta property=\"og:description\" content=\"SQL Server 2016 : availability groups and the new clustered columnstore index support\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2015-06-20T17:25:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog_53_-_1-_cci_new_features.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1110\" \/>\n\t<meta property=\"og:image:height\" content=\"185\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Microsoft Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Microsoft Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\\\/\"},\"author\":{\"name\":\"Microsoft Team\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/bfab48333280d616e1170e7369df90a4\"},\"headline\":\"SQL Server 2016 : availability groups and the new clustered columnstore index support\",\"datePublished\":\"2015-06-20T17:25:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\\\/\"},\"wordCount\":1285,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/04\\\/blog_53_-_1-_cci_new_features.jpg\",\"keywords\":[\"AlwaysOn\",\"Availability groups\",\"Column Store\",\"SQL Server 2016\"],\"articleSection\":[\"Hardware &amp; Storage\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\\\/\",\"name\":\"SQL Server 2016 : availability groups and the new clustered columnstore index support - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/04\\\/blog_53_-_1-_cci_new_features.jpg\",\"datePublished\":\"2015-06-20T17:25:55+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/bfab48333280d616e1170e7369df90a4\"},\"description\":\"SQL Server 2016 : availability groups and the new clustered columnstore index support\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/04\\\/blog_53_-_1-_cci_new_features.jpg\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2022\\\/04\\\/blog_53_-_1-_cci_new_features.jpg\",\"width\":1110,\"height\":185},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Server 2016 : availability groups and the new clustered columnstore index support\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/bfab48333280d616e1170e7369df90a4\",\"name\":\"Microsoft Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g\",\"caption\":\"Microsoft Team\"},\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/author\\\/microsoft-team\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"SQL Server 2016 : availability groups and the new clustered columnstore index support - dbi Blog","description":"SQL Server 2016 : availability groups and the new clustered columnstore index support","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\/","og_locale":"en_US","og_type":"article","og_title":"SQL Server 2016 : availability groups and the new clustered columnstore index support","og_description":"SQL Server 2016 : availability groups and the new clustered columnstore index support","og_url":"https:\/\/www.dbi-services.com\/blog\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\/","og_site_name":"dbi Blog","article_published_time":"2015-06-20T17:25:55+00:00","og_image":[{"width":1110,"height":185,"url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog_53_-_1-_cci_new_features.jpg","type":"image\/jpeg"}],"author":"Microsoft Team","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Microsoft Team","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\/"},"author":{"name":"Microsoft Team","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4"},"headline":"SQL Server 2016 : availability groups and the new clustered columnstore index support","datePublished":"2015-06-20T17:25:55+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\/"},"wordCount":1285,"commentCount":0,"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog_53_-_1-_cci_new_features.jpg","keywords":["AlwaysOn","Availability groups","Column Store","SQL Server 2016"],"articleSection":["Hardware &amp; Storage"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\/","url":"https:\/\/www.dbi-services.com\/blog\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\/","name":"SQL Server 2016 : availability groups and the new clustered columnstore index support - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog_53_-_1-_cci_new_features.jpg","datePublished":"2015-06-20T17:25:55+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4"},"description":"SQL Server 2016 : availability groups and the new clustered columnstore index support","breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog_53_-_1-_cci_new_features.jpg","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/sites\/2\/2022\/04\/blog_53_-_1-_cci_new_features.jpg","width":1110,"height":185},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-2016-availability-groups-and-the-new-clustered-columnstore-index-support\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"SQL Server 2016 : availability groups and the new clustered columnstore index support"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/bfab48333280d616e1170e7369df90a4","name":"Microsoft Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/c44a1a792c059f24055763aa77d80a244467f6eef724a8bd13db8d4a350b7a4c?s=96&d=mm&r=g","caption":"Microsoft Team"},"url":"https:\/\/www.dbi-services.com\/blog\/author\/microsoft-team\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/4996","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/26"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=4996"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/4996\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media\/4997"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=4996"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=4996"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=4996"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=4996"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}