Sql server 只读文件组是否减少了锁定

Sql server 只读文件组是否减少了锁定,sql-server,Sql Server,在常规数据库(即非只读)中,将表放入只读文件组是否会减少访问时的锁定 例如,将单独的文件组设为读写,创建并填充表格,将文件组改为读写。否 只读文件组不会阻止/减少锁定(我假设我们只讨论共享锁,因为没有其他语句是不可能的) 当数据库设置为只读时,只能防止锁定 此处介绍了只读文件组锁定方面: use general go alter database general add filegroup foo go alter database general add file ( name = fi

在常规数据库(即非只读)中,将表放入只读文件组是否会减少访问时的锁定

例如,将单独的文件组设为读写,创建并填充表格,将文件组改为读写。

只读文件组不会阻止/减少锁定(我假设我们只讨论共享锁,因为没有其他语句是不可能的)

当数据库设置为只读时,只能防止锁定

此处介绍了只读文件组锁定方面:

use general
go


alter database general add filegroup foo
go

alter database general add file (
name = file1,
filename = ‘c:tempfile1’)
to filegroup foo

— create a table and associate it to a filegroup
create table t_fg (c1 int, c2 int) on foo
insert into t_fg values (1,1)

— mark the filegroup read-only
alter database general modify filegroup foo read_only

— run a transaction with repeatable read isolation
set transaction isolation level repeatable read
begin tran
select * from t_fg where c1 = 1

— no check the locks
sp_lock @@spid

— here is the output
spid   dbid   ObjId       IndId  Type Resource                         Mode     Status
—— —— ———– —— —- ——————————– ——– ——
53     10     1381579960  0      RID  3:8:0                         S        GRANT
53     10     0                 0      DB                                     S        GRANT
53     10     1381579960  0      PAG  3:8                           IS       GRANT
53     10     1381579960  0      TAB                                   IS       GRANT
53     1      1115151018   0      TAB                                   IS       GRANT