feat(mssql): add mssql-list-indexes tool#3508
Open
debabsah wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request implements a new mssql-list-indexes tool to list user indexes in a SQL Server database, complete with implementation, unit and integration tests, and documentation. The feedback recommends adding a "Requirements" section to the documentation to detail the permissions needed (VIEW DATABASE STATE or VIEW SERVER STATE) to query index usage statistics, aligned with the repository's strict heading order style guide.
a95aa3f to
b278d58
Compare
b278d58 to
8aff07a
Compare
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.
Description
Adds a read-only
mssql-list-indexesprebuilt tool, the SQL Server counterpart topostgres-list-indexes. It is the first tool toward bringing the mssql source to parity with the Postgres read-only estate-exploration suite (agreed in #3496).It lists user indexes, excluding system schemas and heaps, using only catalog views and
sys.dm_db_index_usage_stats, and is marked read-only. It follows the existing Postgres tool and theinternal/tools/mssql/conventions (namedsql.Namedparameters, BaseTool). It filters by schema, table, and index name, takes an optional only-unused flag, and has a configurable row limit.The PR adds the tool (
internal/tools/mssql/mssqllistindexes/), its unit test, the registration incmd/internal/imports.go, the docs page, and an integration test (RunMSSQLListIndexesTest) wired intoTestMSSQLToolEndpoints.A couple of small choices, both easy to change if you prefer:
descriptionis optional here (it defaults), followingpostgres-list-indexes, the tool this mirrors. I can make it required likemssql-list-tablesif you want.sys.dm_db_index_usage_stats, matching the Postgres tool. That DMV needsVIEW SERVER STATE, and the docs page calls that out.PR Checklist
!if this involves a breaking change (it does not)Part of #3496