Clustered Columnstore の最も重要な制限の 1 つはロックです。詳細については、http ://www.nikoport.com/2013/07/07/clustered-columnstore-indexes-part-8-locking/ を参照してください。
ご質問について:
1) 上記のステートメントは、多くの重複値が存在する場合、クラスター化された列ストア インデックスは B ツリー インデックスよりも常にデータを抽出するのに適していると言っていますか?
- 重複がバッチ モードによって高速にスキャンされるだけでなく、セグメントからすべてのデータを読み取るときに、列ストア インデックスのメカニズムがより効果的にデータを読み取ることができます。
2) たとえば、テーブルに多くの列がある場合、クラスター化された列ストア インデックスとクラスター化されていない B ツリー カバー インデックスの間のパフォーマンスはどうでしょうか。
- 列ストア インデックスは、ページまたは行よりも大幅に圧縮率が高く、行ストアで使用できます。バッチ モードは、処理面で最大の違いを生みます。前述のように、同じサイズのページとエクステントの読み取りでも、列ストア インデックスの方が高速です。
3) クラスター化された列ストア インデックスとクラスター化されていない列ストア インデックスを 1 つのテーブルに組み合わせることはできますか?
4) ...テーブルが列化された格納されたインデックスの適切な候補であるかどうかを定義する方法を誰か教えてもらえますか?
- 大量 (100 万行以上) をスキャンおよび処理しているテーブル、または 10 万行を超えるテーブル全体が完全にスキャンされている場合でも、考慮すべき候補となる可能性があります。クラスター化列ストア インデックスを作成するテーブルに関連する使用テクノロジには、いくつかの制限があります。ここでは、私が使用しているクエリを示します。
select object_schema_name( t.object_id ) as 'Schema'
, object_name (t.object_id) as 'Table'
, sum(p.rows) as 'Row Count'
, cast( sum(a.total_pages) * 8.0 / 1024. / 1024
as decimal(16,3)) as 'size in GB'
, (select count(*) from sys.columns as col
where t.object_id = col.object_id ) as 'Cols Count'
, (select count(*)
from sys.columns as col
join sys.types as tp
on col.system_type_id = tp.system_type_id
where t.object_id = col.object_id and
UPPER(tp.name) in ('VARCHAR','NVARCHAR')
) as 'String Columns'
, (select sum(col.max_length)
from sys.columns as col
join sys.types as tp
on col.system_type_id = tp.system_type_id
where t.object_id = col.object_id
) as 'Cols Max Length'
, (select count(*)
from sys.columns as col
join sys.types as tp
on col.system_type_id = tp.system_type_id
where t.object_id = col.object_id and
(UPPER(tp.name) in ('TEXT','NTEXT','TIMESTAMP','HIERARCHYID','SQL_VARIANT','XML','GEOGRAPHY','GEOMETRY') OR
(UPPER(tp.name) in ('VARCHAR','NVARCHAR') and (col.max_length = 8000 or col.max_length = -1))
)
) as 'Unsupported Columns'
, (select count(*)
from sys.objects
where type = 'PK' AND parent_object_id = t.object_id ) as 'Primary Key'
, (select count(*)
from sys.objects
where type = 'F' AND parent_object_id = t.object_id ) as 'Foreign Keys'
, (select count(*)
from sys.objects
where type in ('UQ','D','C') AND parent_object_id = t.object_id ) as 'Constraints'
, (select count(*)
from sys.objects
where type in ('TA','TR') AND parent_object_id = t.object_id ) as 'Triggers'
, t.is_tracked_by_cdc as 'CDC'
, t.is_memory_optimized as 'Hekaton'
, t.is_replicated as 'Replication'
, coalesce(t.filestream_data_space_id,0,1) as 'FileStream'
, t.is_filetable as 'FileTable'
from sys.tables t
inner join sys.partitions as p
ON t.object_id = p.object_id
INNER JOIN sys.allocation_units as a
ON p.partition_id = a.container_id
where p.data_compression in (0,1,2) -- None, Row, Page
group by t.object_id, t.is_tracked_by_cdc, t.is_memory_optimized, t.is_filetable, t.is_replicated, t.filestream_data_space_id
having sum(p.rows) > 1000000
order by sum(p.rows) desc