This is a follow up of ALTER VIEW drops Index from View question.
The accepted response indicates that ALTER VIEW will automatically drop any defined indexes.
This is somewhat counter intuitive to how other similar operations are happening:
- it is natural to expect for related things such as permissions or indexes to be dropped on object drop not on alter
- altering a table does not drop any index (actually you have to drop things like indexes, constraints etc.)
I am wondering about why having this behavior by default in the first place (i.e. is there any objective aspect like performance reduction in some cases due to view alteration).
Question: What is the rationale of dropping all indexes for an altered view?
ALTER VIEW
operations you could do where the existing index would be valid after the alteration (only things like changingENCRYPTION
). The design choice of doing it silently without forcing you to explicitly drop the index(es) first seems highly questionable to me though