patternsqlMinor
Are existing entries immediately included into a newly created index?
Viewed 0 times
areintocreatednewlyincludedexistingindeximmediatelyentries
Problem
Suppose I have a table
and the database confirms that
Will the newly created index immediately include all existing entries from the table or will it be slowly built "in background"? In other words, if I think that creating an index will improve performance then will I see that improvement immediately upon
Stuff with a column City and no indices including that column. I populate the table. Then I decide to create an index:CREATE INDEX [StuffOnCityIndex] ON [dbo].[Stuff](City ASC);and the database confirms that
CREATE INDEX succeeded.Will the newly created index immediately include all existing entries from the table or will it be slowly built "in background"? In other words, if I think that creating an index will improve performance then will I see that improvement immediately upon
CREATE INDEX completion?Solution
The CREATE INDEX is unit of work that follows ACID.
So when it completes, it has completed (or failed) completely ("Atomic" in ACID). No further work is needed to populate or otherwise prepare the index ("Consistent" in ACID)
Whether it improves performance depends on it's suitability for the queries you are running, data distribution etc. That is a whole new area...
So when it completes, it has completed (or failed) completely ("Atomic" in ACID). No further work is needed to populate or otherwise prepare the index ("Consistent" in ACID)
Whether it improves performance depends on it's suitability for the queries you are running, data distribution etc. That is a whole new area...
Context
StackExchange Database Administrators Q#15632, answer score: 6
Revisions (0)
No revisions yet.