database - Why can SQL Server 2012 not add an included column to an existing non clustered index -
i don't understand why not simple
alter index whatever add included (columnname)
what prevent being simple operation sql server add column index , populate value in pages table?
this not affect ordering @ of index, trying optimize select statement. hoping can have less down time 8 hours take drop , rebuild set of indexes sadly disappointed.
because included column in index page, @ moment have like:
page row 1: key 1, key 2, inc 1 row 2: key 1, key 2, inc 1, row 3: key 1, key 2, inc 1 ...
if row 1 starts @ byte 0, row 2 @ byte x, etc
to add new included column need take each page, break rows add column , re-write it, possibly on either 1 page or more 1 pages, including metadata previous pages points - having completly re-write index why not rebuild it.
it cheaper sql server build new index insert little pieces of data here , there.
edit: index fragmentation need rebuild it
Comments
Post a Comment