Search code examples
sqlsql-serverdatabaset-sqlduplicate-data

Insert unique value using Clustered ColumnStore Index


I would like to know how I would go about of creating my table or choosing an insert that make sure that I do not get duplicate values.

create table test.dbo.test
product, 
time,
primary key(product, time)
go

When using Clustered ColumnStore I can not have any unique constraints to know that the data that has been inserted is unique. Is there another way to check this?


Solution

  • Here is a work-around that uses materialized views.

    http://sqlwithmanoj.com/2014/07/24/maintaining-uniqueness-with-clustered-columnstore-index-sql-server-2014/