Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 459
eleijonmarck Avatar asked Sep 01 '14 10:09

eleijonmarck


1 Answers

Here is a work-around that uses materialized views.

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

like image 146
Jonathan Allen Avatar answered Nov 14 '22 10:11

Jonathan Allen