简体   繁体   中英

Non Clustered Columnstore Indexes and Primary/Foreign keys

Documentation says that we can't create nonclustered columnstore indexes in primary key or foreign key columns

https://docs.microsoft.com/en-us/sql/t-sql/statements/create-columnstore-index-transact-sql

" A table with a nonclustered columnstore index can have unique constraints, primary key constraints, or foreign key constraints, but the constraints cannot be included in the nonclustered columnstore index . "

but on my tests, It is working:

CREATE TABLE SimpleTable(  
ProductKey [int] primary key,   
OrderDateKey [int] NOT NULL,   
DueDateKey [int] NOT NULL,   
ShipDateKey [int] NOT NULL) 

GO

insert into SimpleTable values (1,2,3,4)

CREATE nonclustered COLUMNSTORE INDEX IXTEST ON SimpleTable(ProductKey)

What am I missing here? Is documentation correct?

Here is my SQL Server version

Microsoft SQL Server 2016 (SP1-CU4) (KB4024305) - 13.0.4446.0 (X64) Jul 16 2017 18:08:49 Copyright (c) Microsoft Corporation Developer Edition

Regards

我不确定该语句的重要性,因为约束仍然存在于表中,但是我想,纯粹基于语言,我想说的是约束不能包括在内,但可以包括在内。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM