Skip to content

sp_kill: Add @EmergencyMode input parameter to minimize work done by the procedure #3956

@jobbish-sql

Description

@jobbish-sql

Is your feature request related to a problem? Please describe.
(theoretical issue based on reading the code) I could be an end user having a performance emergency on my server but sp_kill is taking a long time to return results because there are some executing queries with huge query plans. It takes a long time to write the query_plan and live_query_plan columns to the temp table and it takes a long time for SSMS to render the result set that includes the XML columns.

Describe the solution you'd like
Add an input parameter @EmergencyMode BIT = 0

If @EmergencyMode = 1, then sp_kill should avoid all optional work that could result in delays on very busy servers. Suggestions:

  • don't write the query_plan and live_query_plan columns to the temp table
  • don't attempt to create the output table if it doesn't exist (I've seen create table statements take over a minute on extremely busy servers)
  • don't attempt to write rows to the output table

Describe alternatives you've considered
Could also have an input parameter @SkipQueryPlans BIT = 0 that only skips the query_plan and live_query_plan columns

Are you ready to build the code for the feature?
Yes, but I'd like your guidance on which features of sp_kill could be considered to be optional when the procedure is run in emergency mode.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions