Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,25 +350,25 @@ EXEC sp_kill @SPID = 55, @ExecuteKills = 'Y';

/* Kill sleeping sessions with open transactions idle for 5+ minutes: */
EXEC sp_kill @HasOpenTran = 'Y', @SPIDState = 'S',
@RequestsOlderThanMinutes = 5, @ExecuteKills = 'Y';
@RequestsOlderThanSeconds = 300, @ExecuteKills = 'Y';

/* Show what we'd kill for a login, sorted by CPU: */
EXEC sp_kill @LoginName = 'DOMAIN\TroublesomeUser', @OrderBy = 'cpu';
```

Parameters for targeting sessions:

* @ExecuteKills = 'Y' or 'N' (default 'N') - whether to actually kill, or just show recommendations. When set to 'Y', you must also specify at least one targeting filter to prevent accidentally killing everything.
* @ExecuteKills = 'Y' or 'N' (default 'N') - whether to actually kill, or just show recommendations. When set to 'Y' with no targeting filters, all non-system sessions are killed - so always specify at least one filter to avoid killing everything.
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wording “all non-system sessions are killed” is a bit too absolute: sp_kill excludes the caller’s own session (s.session_id <> @OurSessionID) and never recommends/kills sessions in rollback status. Consider adjusting this sentence to match the proc’s actual eligibility rules (e.g., user sessions with session_id > 50, excluding your own and rollbacks) to avoid an apparent contradiction with the Safety features section below.

Suggested change
* @ExecuteKills = 'Y' or 'N' (default 'N') - whether to actually kill, or just show recommendations. When set to 'Y' with no targeting filters, all non-system sessions are killed - so always specify at least one filter to avoid killing everything.
* @ExecuteKills = 'Y' or 'N' (default 'N') - whether to actually kill, or just show recommendations. When set to 'Y' with no targeting filters, sp_kill can kill broadly across eligible user sessions (for example, user sessions with session_id > 50), excluding your own session and sessions already in rollback - so always specify at least one filter to avoid killing nearly everything.

Copilot uses AI. Check for mistakes.
* @SPID - target a specific session ID.
* @LoginName - kill sessions belonging to this login.
* @AppName - kill sessions from this application (supports LIKE wildcards).
* @DatabaseName - kill sessions using this database.
* @HostName - kill sessions from this host.
* @LeadBlockers = 'Y' - kill only lead blockers (sessions blocking others but not blocked themselves).
* @ReadOnly = 'Y' - only kill read-only queries (SELECTs with no writes).
* @SPIDState - 'S' for sleeping sessions only, 'R' for running only, empty string for both (default).
* @SPIDState - 'S' for sleeping sessions only, 'R' for running only, NULL for both (default).
* @HasOpenTran = 'Y' - only target sessions with open transactions. Combine with @SPIDState = 'S' to catch sleeping sessions with forgotten transactions.
* @RequestsOlderThanMinutes - only target sessions whose last request started at least this many minutes ago.
* @RequestsOlderThanSeconds - only target sessions whose last request started at least this many seconds ago.
* @OmitLogin - exclude sessions belonging to this login from kill recommendations.
* @OrderBy - sort order for kill recommendations: duration (default), cpu, reads, writes, tempdb, transactions. Useful when you want to kill the worst offenders one by one.

Expand Down