views:

26

answers:

1

I am trying to understand what is going on with CREATE INDEX internally. When I create a NONCLUSTERED index it shows as an INSERT in the execution plan as well as when I get the query test.

DECLARE @sqltext VARBINARY(128)
SELECT @sqltext = sql_handle
FROM sys.sysprocesses s
WHERE spid = 73 --73 is the process creating the index
SELECT TEXT
FROM sys.dm_exec_sql_text(@sqltext)
GO

Show:

insert [dbo].[tbl] select * from [dbo].[tbl] option (maxdop 1)

This is consistent in the execution plan. Any info is appreciated.

+1  A: 

This was my lack of knowledge on indexes, what a difference 4 months of experience makes! :)

The index creation will cause writes to the index to insert the leafs as needed.

Dustin Laine