Read only groups of READ files

In a regular DB (i.e. not read-only), does the tables in the group make the tables read-only by reducing the locks on access?

eg. Make a separate group of files like Read Write, Create and Populate Tables, Change File Group to Read Write.

+3


source to share


1 answer


Not.

Only for reading. Filegroups do not prevent / mitigate locking (I assume we are only talking about shared locks since no other assertions are possible).

Blocking can be prevented only when the database is set to read-only



Considerations for blocking read-only groups are covered here: Read- only filegroups and blocking

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

      

+3


source







All Articles