Skip to content

Conversation

@srutzky
Copy link
Contributor

@srutzky srutzky commented Jan 16, 2018

Details for both base_id and magnitude columns state the incorrect value for when encoding_type <> 1. The following query shows the correct values:

DROP TABLE IF EXISTS dbo.ClusteredColumnstoreIndexTest;
CREATE TABLE dbo.ClusteredColumnstoreIndexTest
(
[a] VARCHAR(200) DEFAULT 'a',
[b] VARCHAR(MAX) DEFAULT 'a',
[c] NVARCHAR(100) DEFAULT 'a',
[d] NVARCHAR(MAX) DEFAULT 'a',

[e] DATETIME,
[f] DATETIME2,
[g] DATE,
[h] TIME,
[i] DATETIMEOFFSET,

[j] TINYINT DEFAULT 1,
[k] SMALLINT DEFAULT 1,
[l] INT DEFAULT 1,
[m] BIGINT DEFAULT 1,

[n] DECIMAL(20,10),
[o] FLOAT,
[p] MONEY,

INDEX [CCI_ClusteredColumnstoreIndexTest] CLUSTERED COLUMNSTORE
);

INSERT INTO dbo.[ClusteredColumnstoreIndexTest] DEFAULT VALUES;

ALTER INDEX [CCI_ClusteredColumnstoreIndexTest] ON dbo.[ClusteredColumnstoreIndexTest] REBUILD;


SELECT css.[column_id], css.[encoding_type], css.[base_id], css.[magnitude]
FROM   sys.column_store_segments css
INNER JOIN sys.partitions prt
        ON prt.[hobt_id] = css.[hobt_id]
WHERE  OBJECT_NAME(prt.[object_id]) = N'ClusteredColumnstoreIndexTest'
ORDER BY css.[column_id];

That returns the following, which shows that when encoding_type <> 1, then the other two columns are both -1:

1	3	-1	-1
2	3	-1	-1
3	3	-1	-1
4	3	-1	-1
5	2	-1	-1
6	2	-1	-1
7	2	-1	-1
8	2	-1	-1
9	3	-1	-1
10	1	-2	1
11	1	-2	1
12	1	-2	1
13	1	-2	1
14	3	-1	-1
15	2	-1	-1
16	2	-1	-1

@PRMerger3
Copy link
Contributor

@srutzky : Thanks for your contribution to the SQL documentation! The author, @edmacauley, has been notified to review your proposed change.

@edmacauley
Copy link
Contributor

Thanks @srutzky for fixing this content and providing a copy and paste example. 🥇

@craigg-msft craigg-msft merged commit 60cebfa into MicrosoftDocs:live Jan 17, 2018
@srutzky
Copy link
Contributor Author

srutzky commented Jan 18, 2018

@edmacauley You are welcome. And, no problem at all re: the copy and paste example. If I ever update the technical info, I will provide an example either in the initial comment (like I did here) or in a blog post that I will link to.

@srutzky srutzky deleted the SRutzky-FixColumnStoreSegments branch January 18, 2018 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants