Cursor-aware rules (#215 E1, E2, E3)#272
Merged
erikdarlingdata merged 1 commit intodevfrom Apr 24, 2026
Merged
Conversation
Rule 36 — Dynamic Cursor (E1): statement-level warning when CursorActualType is "Dynamic". Dynamic cursors can't use many indexes because they must tolerate data changes between fetches; recommends FAST_FORWARD / STATIC / KEYSET as the usual fix. Rule 37 — Cursor Missing LOCAL (E3): regex-scans statement text for DECLARE <name> [qualifiers] CURSOR FOR without LOCAL in the qualifier list. Default cursor scope is GLOBAL which bloats the plan cache — links to Erik's blog post on OPENJSON cursor declarations. Rule 11 augmentation (E2): when Scan With Predicate fires on a statement whose CursorActualType is Dynamic, the message now points at the cursor as the root cause instead of suggesting more indexes. Verified on Joe's plan P7opX79MzB — the clustered-index-scan warning now reads "This query is running inside a dynamic cursor, which can prevent index usage; changing the cursor type often fixes scans like this without any indexing change." No regressions on non-cursor plans (c1-c5.sqlplan, 20260415_1.sqlplan). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Verified on Joe's `P7opX79MzB` plan. No false positives on existing plans.
Part of the v1.8.0 batch.
🤖 Generated with Claude Code