You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Consider adding AlterIndexOperation to Migrations #20692
Currently a FILLFACTOR change causes a DROP and CREATE of the index on which the fillfactor is defined. But in SQL Server (2008 onwards) it's possible to just do:
ALTERINDEX REBUILD WITH FILLFACTOR nn
We should consider the relative performance of ALTER INDEX versus DROP and CREATE and perhaps add an AlterIndexOperation class to migrations.
Note: several other operations are allowed on ALTER INDEX. We would need to consider which of them to support.
On SQL Server, it looks like this syntax avoids the need to rebuild referencing foreign keys. However, this is minimized by the fact that any foreign keys created by EF will be referencing unique constraints and not unique indexes.
Another thought on this: when the migrations SQL generator sees an AlterIndexOperation with a facet that cannot be altered, it can automatically drop and recreate the index. This would save users the trouble of having to do it themselves.
Activity
bricelam commentedon Apr 22, 2020
On SQL Server, it looks like this syntax avoids the need to rebuild referencing foreign keys. However, this is minimized by the fact that any foreign keys created by EF will be referencing unique constraints and not unique indexes.
roji commentedon Apr 23, 2020
FWIW PG also allows various index modifications. I think there's more than enough reason to do this.
roji commentedon Oct 17, 2022
Another thought on this: when the migrations SQL generator sees an AlterIndexOperation with a facet that cannot be altered, it can automatically drop and recreate the index. This would save users the trouble of having to do it themselves.
roji commentedon Oct 27, 2023
FWIW I just ran into this again in a PG-related thing (npgsql/efcore.pg#2899).