Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
In the blog https://blogs.msdn.microsoft.com/sqlserverstorageengine/2016/03/07/columnstore-index-defragmentation-using-reorganize-command/ , we discussed how REORGANIZE command can be used to defragment a columnstore index. In this blog, we will describe how REORGANIZE processes the compressed rowgroups.
A compressed rowgroup is considered as fragmented when any of the following two conditions is met
When REORGANNIZE command runs, it applies the following policy for each of the eligible compressed rowgroups
Here are some examples
Example: The compressed rowgroup has 10% of 1048576 rows marked as deleted, it qualifies for self-merge to remove the deleted rows. If only say 50k rows were marked deleted, it won't be eligible for self-merge.
Current size | Deleted rows | Self-Merge |
300k | 120 k | Yes |
Example: If a compressed rowgroup has < 90% of the 1048576 rows after accounting for deleted rows, it qualifies for the merge. Here are some examples
Rowgroup1 | Rowgroup2 | Merge? |
950k | 920k | No (don’t qualify for merge) |
900k | 900k | No (we can’t exceed 1 million in the merge size) |
400k | 500k | Yes, 900k |
1 million (200k deleted) | 500k (300k deleted) | Yes, 1 million |
Example:
If you have three rowgroups that qualify for merge, they are considered for merge in sequential order. For example, rowwgroup1 (100k), rowgroup2 (850k) and rowgroup3 (350k) - we will merge the first two qualifying ones.
This merge policy is just a heuristic and we will evolve it as our experience with customer workload grows.
Thanks
Sunil
Please sign in to use this experience.
Sign in