Deleting from a clustered columnstore index

Let's test what happens when you delete rows from a CCI with the following DELETE command. Before executing the command, you can check the estimated execution plan. Therefore, don't execute the following command yet:

DELETE 
FROM dbo.FactTest 
WHERE SaleKey >= 12000000; 

The following screenshot shows the actual execution plan. You can see that, for the Columnstore Index Delete operator, row mode was used again:

Estimated execution plan for a DELETE

And here is a final check of the state of the rowgroups:

SELECT OBJECT_NAME(object_id) AS table_name, row_group_id, state, state_desc, total_rows, deleted_rows ...

Get SQL Server 2017 Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.