cancel_query
Cancel a running PostgreSQL query by its backend PID to halt resource-intensive operations. Preview with dry-run before applying.
Instructions
[WRITE][risk=high] Cancel a backend's running query (pg_cancel_backend). No inverse.
Captures the backend's pid + query for audit; a cancel has no undo. Pass
dry_run=True to preview.
Refuses this tool's own backend pid — the query it would cancel is this very
call. Enforced under dry_run too.
Args:
pid: Backend process id (from list_activity).
dry_run: If True, preview without cancelling.
target: Target name from config; omit for the default.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pid | Yes | ||
| target | No | ||
| dry_run | No |