I have an active directory group login (external users) that I need to limit the cost of their query.
I know we can prevent a query from running if its cost exceeds a threshold with the sp_configure 'query governor cost limit' but we don't want ALL queries to not run if above the threshold. We only want this to apply to our external users, who are all members of the AD group login.
Another option would be to control the individual session with "set query governor cost limit". This would work if there is a way to guarantee that this setting would get set when the user logs in. Is there any way to run a session level start up script (in unix we can run .bashrc scripts to set environment variables, for example). Ideally, the savy user would not be able to reset this back to 0.
A logon trigger is not an option here, since SET commands are reset to the initial state once the trigger (or stored procedure) exits.
SSMS has an option to set the query_governer_cost_limt (SSMS==>Options==>Query Execution==>SQL Server==>Advanced). Is there a way to pre-set this value in SSMS? And then disable the user's ability to reset it back to 0? My guess is that SSMS can be preset with registry changes... hoping not to have to go there for individual logins.
Resource gov is another option that will place restrictions, but it is not the same.