Skip to content

Commit 1a3442b

Browse files
authored
Merge pull request #90543 from XiaoyuMSFT/occiperf
updates
2 parents 097284e + 3ec4dc3 commit 1a3442b

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

articles/sql-data-warehouse/performance-tuning-ordered-cci.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,43 @@ ORDER BY o.name, pnp.distribution_id, cls.min_data_id
4040
> [!NOTE]
4141
> In an ordered CCI table, new data resulting from DML or data loading operations are not automatically sorted. Users can REBUILD the ordered CCI to sort all data in the table.
4242
43+
## Query performance
44+
45+
A query's performance gain from an ordered CCI depends on the query patterns, the size of data, how well the data is sorted, the physical structure of segments, and the DWU and resource class chosen for the query execution. Users should review all these factors before choosing the ordering columns when designing an ordered CCI table.
46+
47+
Queries with all these patterns typically run faster with ordered CCI.
48+
1. The queries have equality, inequality, or range predicates
49+
1. The predicate columns and the ordered CCI columns are the same.
50+
1. The predicate columns are used in the same order as the column ordinal of ordered CCI columns.
51+
52+
In this example, table T1 has a clustered columnstore index ordered in the sequence of Col_C, Col_B, and Col_A.
53+
54+
```sql
55+
56+
CREATE CLUSTERED COLUMNSTORE INDEX MyOrderedCCI ON T1
57+
ORDER (Col_C, Col_B, Col_A)
58+
59+
```
60+
61+
The performance of query 1 can benefit more from ordered CCI than the other 3 queries.
62+
63+
```sql
64+
-- Query #1:
65+
66+
SELECT * FROM T1 WHERE Col_C = 'c' AND Col_B = 'b' AND Col_A = 'a';
67+
68+
-- Query #2
69+
70+
SELECT * FROM T1 WHERE Col_B = 'b' AND Col_C = 'c' AND Col_A = 'a';
71+
72+
-- Query #3
73+
SELECT * FROM T1 WHERE Col_B = 'b' AND Col_A = 'a';
74+
75+
-- Query #4
76+
SELECT * FROM T1 WHERE Col_A = 'a' AND Col_C = 'c';
77+
78+
```
79+
4380
## Data loading performance
4481

4582
The performance of data loading into an ordered CCI table is similar to data loading into a partitioned table.

0 commit comments

Comments
 (0)