Skip to content

Docs: per-database grants for FinOps Index Analysis (#915)#929

Merged
erikdarlingdata merged 2 commits intodevfrom
feature/915-finops-index-perms-docs
May 4, 2026
Merged

Docs: per-database grants for FinOps Index Analysis (#915)#929
erikdarlingdata merged 2 commits intodevfrom
feature/915-finops-index-perms-docs

Conversation

@erikdarlingdata
Copy link
Copy Markdown
Owner

Summary

Closes part of #915. Documents the per-database grants that prevent FinOps Index Analysis (`sp_IndexCleanup`) from hanging at 100% CPU when the dashboard/Lite login lacks user mapping in a target database.

Changes

  • README.md / Permissions — new `### FinOps Index Analysis (per-database grants)` subsection between the Lite (On-Premises) and Azure SQL Database subsections. Applies to both editions. Includes:
  • README.md / Troubleshooting — new item 5 under the shared troubleshooting list naming the symptom ("FinOps Index Analysis hangs or times out") and linking to the new permissions subsection.

Out of scope

  • The `HAS_DBACCESS()` preflight inside `sp_IndexCleanup` itself lives in the DarlingData repo and will be a separate PR there. The bundled copy in `install/` here will get bumped after that lands.
  • Microsoft follow-up about the engine recompile bug — external, not actionable in this repo.

Test plan

🤖 Generated with Claude Code

erikdarlingdata and others added 2 commits May 3, 2026 11:05
Adds a Permissions subsection covering the per-user-database mapping +
VIEW DATABASE STATE + VIEW DEFINITION grants that sp_IndexCleanup needs
to avoid hanging at 100% CPU when the dashboard/Lite login lacks access
to a target database. Includes a single-DB block and an sp_MSforeachdb
helper, plus the engine-bug explanation (infinite recompile loop, not
sys.dm_db_partition_stats per se).

Adds a matching troubleshooting entry naming the hang symptom and
linking to the new section.
Earlier permissions block was incomplete. VIEW DATABASE STATE +
VIEW DEFINITION are necessary but not sufficient: sp_IndexCleanup
also queries sys.sql_expression_dependencies via three-part name
when scanning for computed columns / check constraints with UDF
references, and SELECT on that catalog view defaults to db_owner
only. VIEW DEFINITION does not include it.

OP confirmed in the issue thread that the previous grant set still
yielded Msg 229 on a real workload database. Reproduced locally on
SQL2019 with a database containing a UDF-bound computed column and
check constraint; adding GRANT SELECT ON sys.sql_expression_dependencies
clears it. Run completes in <1s and returns the expected UDF rows.

Updates:
- Single-DB and sp_MSforeachdb blocks now include the third grant.
- Symptoms section split into the two distinct failure modes (hang
  vs. Msg 229) so readers can identify which grant they are missing.
- Troubleshooting bullet covers both symptoms.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@erikdarlingdata erikdarlingdata merged commit acefc56 into dev May 4, 2026
2 checks passed
@erikdarlingdata erikdarlingdata deleted the feature/915-finops-index-perms-docs branch May 4, 2026 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant