Sets custom execution attributes for a session while the session is active.
sp_setpsexe spid, exeattr, value
If exeattr is priority, value is HIGH, MEDIUM, or LOW.
If exeattr is enginegroup, value is the name of an existing engine group.
sp_setpsexe 1, "priority", "HIGH"
Execution attribute values specified with sp_setpsexe are valid for the current session only and do not apply after the session terminates.
Use sp_setpsexe with caution or it can result in degraded performance. Changing attributes “on the fly”, using sp_setpsexe, can help if the process is not getting CPU time; however, if the performance problem is due to something else, such as locks, changing execution attributes could make the problem worse.
Because you can only set execution attributes for sessions, sp_setpsexe cannot be set for a worker process spid.
Except for the housekeeper spid, you cannot set execution attributes for system spids.
sp_setpsexe does not work if there are no online engines in the associated engine group.
The permission checks for sp_setpsexe differ based on your granular permissions settings.
Setting | Description |
---|---|
Enabled | With granular permissions enabled, you must be a user with manage any execution class privilege. Any user can execute sp_setpsexe to lower the priority of a process owned by that user. |
Disabled | With granular permissions disabled, you must be a user with sa_role. Any user can execute sp_setpsexe to lower the priority of a process owned by that user. |
Values in event and extrainfo columns from the sysaudits table are:
Information | Values |
---|---|
Event | 38 |
Audit option | exec_procedure |
Command or access audited | Execution of a procedure |
Information in extrainfo |
|