Contents

1 谿瑚襭


1 谿瑚襭 #

--adhoc query襯  resource pool
create resource pool readeradhocpool
with
(
 min_cpu_percent=25, max_cpu_percent=50,
 min_memory_percent=25, max_memory_percent=50
)
go

--workload group to be used by reader login
create workload group readeradhogroup
    using readeradhocpool ;
go


use master;
go
create function dbo.resource_classifier() 
returns sysname 
with schemabinding
as
begin
	declare @workloadgroup as sysname
	
	if (suser_name() = 'reader')
		set @workloadgroup = 'readeradhogroup'
--	else if (suser_name() = 'reportuser')
--		set @workloadgroup = 'reportgroup'
	else 
		set @workloadgroup = 'default'

	return @workloadgroup
end
go

alter resource governor 
with (classifier_function=dbo.resource_classifier);
go
alter resource governor reconfigure
go
--alter resource governor disable
--go
alter resource governor reset statistics
go