What problem does it solve? Stale or missing optimizer statistics cause poor query plans and sudden performance degradation in CockroachDB, and diagnosing them without DB Console access is difficult. This Skill provides read-only SQL queries using SHOW STATISTICS to detect stale statistics, missing column coverage, and row count drift before they impact production queries. ## Core Features & Use Cases - Staleness Detection: Identify tables with outdated or missing statistics, ranked by age, with workload-specific thresholds for OLTP and OLAP. - Drift and Coverage Analysis: Compare actual row counts against cached statistics, find columns lacking statistics or histograms, and detect missing multi-column statistics for correlated columns. - Remediation Guidance: Generate ready-to-run CREATE STATISTICS commands, monitor collection jobs via SHOW JOBS, and follow batch execution patterns that avoid overwhelming the cluster. - Use Case: After a bulk data load, run the drift detection query on affected tables, generate CREATE STATISTICS commands for tables exceeding 20% drift, and monitor the jobs to completion to restore accurate optimizer estimates. ## Quick Start Ask the AI to audit table statistics in your CockroachDB database and list any tables with stale or missing optimizer statistics.