Quantcast
Channel: Forum SQL Server Database Engine
Viewing all articles
Browse latest Browse all 15889

Create a ColumnStore Index on a Partitioned Table

$
0
0

I'm having difficulty creating a ColumnStore index on a partitioned table.  If I try to align the index with a partitions, I get this error:

Msg 2726, Level 16, State 1, Line 1
Partition function 'LabsQuarterPartitioned' uses 1 columns which does not match with the number of partition 
columns used to partition the table or index.

Here is my partition function:

CREATE PARTITION FUNCTION [LabsQuarterPartitioned](datetime) 
AS RANGE RIGHT FOR VALUES (N'2000-01-01T00:00:00.000', N'2000-04-01T00:00:00.000', N'2000-07-01T00:00:00.000', 
N'2000-10-01T00:00:00.000', N'2001-01-01T00:00:00.000', N'2001-04-01T00:00:00.000', N'2001-07-01T00:00:00.000', 
N'2001-10-01T00:00:00.000', N'2002-01-01T00:00:00.000', N'2002-04-01T00:00:00.000', N'2002-07-01T00:00:00.000',
 N'2002-10-01T00:00:00.000', N'2003-01-01T00:00:00.000', N'2003-04-01T00:00:00.000', N'2003-07-01T00:00:00.000', 
 N'2003-10-01T00:00:00.000', N'2004-01-01T00:00:00.000', N'2004-04-01T00:00:00.000', N'2004-07-01T00:00:00.000', 
 N'2004-10-01T00:00:00.000', N'2005-01-01T00:00:00.000', N'2005-04-01T00:00:00.000', N'2005-07-01T00:00:00.000', 
 N'2005-10-01T00:00:00.000', N'2006-01-01T00:00:00.000', N'2006-04-01T00:00:00.000', N'2006-07-01T00:00:00.000', 
 N'2006-10-01T00:00:00.000', N'2007-01-01T00:00:00.000', N'2007-04-01T00:00:00.000', N'2007-07-01T00:00:00.000',
  N'2007-10-01T00:00:00.000', N'2008-01-01T00:00:00.000', N'2008-04-01T00:00:00.000', N'2008-07-01T00:00:00.000', 
  N'2008-10-01T00:00:00.000', N'2009-01-01T00:00:00.000', N'2009-04-01T00:00:00.000', N'2009-07-01T00:00:00.000', 
  N'2009-10-01T00:00:00.000', N'2010-01-01T00:00:00.000', N'2010-04-01T00:00:00.000', N'2010-07-01T00:00:00.000', 
  N'2010-10-01T00:00:00.000', N'2011-01-01T00:00:00.000', N'2011-04-01T00:00:00.000', N'2011-07-01T00:00:00.000', 
  N'2011-10-01T00:00:00.000', N'2012-01-01T00:00:00.000', N'2012-04-01T00:00:00.000', N'2012-07-01T00:00:00.000',
   N'2012-10-01T00:00:00.000');

And here is my partitioning scheme:

CREATE PARTITION SCHEME [LabsQuarterPartitionedSchema] AS PARTITION [LabsQuarterPartitioned] TO ([LABS1999Year], [LABS2000Q1], [LABS2000Q2], [LABS2000Q3], [LABS2000Q4], [LABS2001Q1], [LABS2001Q2], [LABS2001Q3], [LABS2001Q4], [LABS2002Q1], [LABS2002Q2], [LABS2002Q3], [LABS2002Q4], [LABS2003Q1], [LABS2003Q2], [LABS2003Q3], [LABS2003Q4], [LABS2004Q1], [LABS2004Q2], [LABS2004Q3], [LABS2004Q4], [LABS2005Q1], [LABS2005Q2], [LABS2005Q3], [LABS2005Q4], [LABS2006Q1], [LABS2006Q2], [LABS2006Q3], [LABS2006Q4], [LABS2007Q1], [LABS2007Q2], [LABS2007Q3], [LABS2007Q4], [LABS2008Q1], [LABS2008Q2], [LABS2008Q3], [LABS2008Q4], [LABS2009Q1], [LABS2009Q2], [LABS2009Q3], [LABS2009Q4], [LABS2010Q1], [LABS2010Q2], [LABS2010Q3], [LABS2010Q4], [LABS2011Q1], [LABS2011Q2], [LABS2011Q3], [LABS2011Q4], [LABS2012Q1], [LABS2012Q2], [LABS2012Q3], [LABS2012Q4])

And here is the code to create the index:

CREATE NONCLUSTERED COLUMNSTORE INDEX [csiLabs]
ON [dbo].[Labs] ([LabID], [NativeLabID], [LabtestDate], [LabSource], [LabtestID], [NativeLabtestID], [CollectionDateTime], 
	[CategoricResult], [NumericResultFormat], [ResultTypeID], [bTrueFirst], [NormalSeverityID], [NativeNormalSeverityID], 
	[NormalRangeID], [NativeNormalRangeID], [AcctNumID], [NativeAcctNumID],	[AcctTypeID], [NativeAcctTypeID], [PatientID], 
	[NativePatientID], [MRN], [OrderingProviderID], [NativeOrderingProviderID], [CLGOrderingProviderID], [ClinicID], 
	[NativeClinicID], [CLGClinicID], [NativeCLGClinicID], [LabText]
) WITH (DROP_EXISTING = ON) ON [LabsQuarterPartitionedSchema];

The table is partitioned on the LabtestDate column, which is part of my index.  I don't understand what the problem is here.


Viewing all articles
Browse latest Browse all 15889

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>