What problem does it solve?
This Skill helps you diagnose and improve slow or inefficient SQL queries by applying cross-database performance best practices and validating changes with execution plan analysis.
Core Features & Use Cases
- Universal query tuning: identify anti-patterns (like SELECT * and non-sargable predicates), improve JOIN/subquery structure, and optimize aggregation, pagination, and batching approaches.
- Index strategy guidance: design appropriate composite/covering/partial indexes and align WHERE clause column order with available indexes (including Protheus SIX dictionary alignment).
- Protheus/AdvPL-specific optimization: recommend the correct patterns for FWExecStatement/TCSqlExec usage, temporary tables, NOLOCK for read-only queries, and guidance on workarea vs embedded SQL choices.
Use cases include resolving “slow query” complaints, reducing full table scans, improving pagination performance, and refactoring Protheus SQL/AdvPL execution patterns for higher throughput.
Quick Start
Ask the agent to optimize your SQL by analyzing the execution plan, proposing index and query rewrites, and providing a Protheus-safe AdvPL guidance when applicable.