foreign keys - SQL ALTER TABLE SET (LOCK_ESCALATION = TABLE) on production server -
i need create new table have foreign key users
table.
users table has 2 millions of records.
when run script on our test server locks table , test users cannot query table during transaction.
query starts like;
begin transaction go alter table dbo.users set (lock_escalation = table) go commit /*create new table , foreign keys here*/
what safe way run on production without locking it?
should set production server in "maintenance mode" , set live again when sql transaction complete?
for creating new table , foreign keys, , new table indexes, don't need lock or set lock_escalation of referred table (in case, dbo.users). not run above transaction, new table , foreign keys creation.
Comments
Post a Comment