Progress Report: Online Index Operation Event Class

SQL Server Profiler offers an Event Class called Progress Report: Online Index Operation.
 
image0
 
Below is a screen shot of the SQL Server Profiler output when a Clustered and Non-Clustered index is rebuilt online i.e.
 

USE [database_1]
GO
ALTER INDEX ALL ON [dbo].[Table_1]
REBUILD WITH (ONLINE = ON)
GO

 
click on the image to enlarge
image1
 
The Stage 1 and Stage 2 references in the EventSubClass column may appear a bit confusing. The stages are explained here, along with the meaning of the other columns.
 
If for example only the Non-Clustered index was rebuilt online then only Stage 1 is shown in the output as follows i.e.
 

USE [database_1]
GO
ALTER INDEX [nci] ON [dbo].[Table_1] 
REBUILD WITH (ONLINE = ON)
GO

 
click on the image to enlarge
image2
 
Unfortunately there is not an estimate of when the rebuild will complete included in profiler and the below query will always show 0 percent complete. Currently only ALTER INDEX REORGANIZE will show the estimated percent completed.
 

SELECT text,start_time,percent_complete
FROM sys.dm_exec_requests er
CROSS APPLY sys.dm_exec_sql_text(er.sql_handle)
WHERE 1=1
AND command = 'ALTER INDEX'

 
image3
 
If the rebuild is taking a really long time, a simple quick check would be to take a look at the Index Properties and compare against the BigintData1 column in Profiler to gauge how may rows are remaining to be processed
 
image4
 
or you could use a query like:
 

USE [database_1]
GO
SELECT OBJECT_NAME(id) as table_name,name AS index_name,rowcnt
FROM sys.sysindexes
WHERE 1=1
AND name = 'nci'
GO

 
image5

Leave a Reply