When you are creating a new index on a table, Table locks are applied for the duration of the index operation. For large tables, index creations can take a longer time and this prevents user access to the table till the index gets created.
However if you want to allow users to access the table even when new indexes are being created, you can do so using the ONLINE option. Here’s a query that shows how:
CREATE NONCLUSTERED INDEX IX_VendorAddress_AddressTypeIDNote: By default, the ONLINE option is set to OFF.
ON Purchasing.VendorAddress(AddressTypeID)
WITH (ONLINE = ON)
No comments:
Post a Comment