Skip to main content
Glama

analyze_workload_indexes

Identify frequently executed database queries and provide recommendations for optimal indexing to improve query performance and database efficiency.

Instructions

Analyze frequently executed queries in the database and recommend optimal indexes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
max_index_size_mbNoMax index size in MB

Implementation Reference

  • The main handler function for the 'analyze_workload_indexes' tool. It uses either DatabaseTuningAdvisor or LLMOptimizerTool to analyze workload and recommend indexes, wrapped with validation and error handling.
    @mcp.tool(description="Analyze frequently executed queries in the database and recommend optimal indexes") @validate_call async def analyze_workload_indexes( max_index_size_mb: int = Field(description="Max index size in MB", default=10000), method: Literal["dta", "llm"] = Field(description="Method to use for analysis", default="dta"), ) -> ResponseType: """Analyze frequently executed queries in the database and recommend optimal indexes.""" try: sql_driver = await get_sql_driver() if method == "dta": index_tuning = DatabaseTuningAdvisor(sql_driver) else: index_tuning = LLMOptimizerTool(sql_driver) dta_tool = TextPresentation(sql_driver, index_tuning) result = await dta_tool.analyze_workload(max_index_size_mb=max_index_size_mb) return format_text_response(result) except Exception as e: logger.error(f"Error analyzing workload: {e}") return format_error_response(str(e))

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/crystaldba/postgres-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server