indexing - Alter Non Clustered Index in SQL Server to Add more included columns -


is possible alter existing non clustered index include more columns part of covered columns.

e.g.

alter index ix_nc_tablename_columnname tablename(columnname) include(col1, col2, col3) 

want include col4 in above index.

what impact of adding column? there fragmentation or else?

the cost of additional included column increased storage , potentially fragmentation. fragmentation increase compared old index due increased leaf node size (assuming keys not incremental) , if updates new included column increases length.

consider using create index...with drop existing task. avoid dropping old index , avoid sort, leverage existing index key sequence rebuild:

create index ix_nc_tablename_columnname on tablename(columnname) include(col1, col2, col3, col4) with(drop_existing = on); 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -