observer-sql-analysis

Analyze a single SQL's performance, plan, trace, and locks in OceanBase.

161|40|Updated Nov 22, 2022
One-click install
npx skills add https://github.com/oceanbase/obdiag --skill observer-sql-analysis
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: observer-sql-analysis
Source: https://github.com/oceanbase/obdiag/tree/main/plugins/agent/skills/observer-sql-analysis
Command: npx skills add https://github.com/oceanbase/obdiag --skill observer-sql-analysis

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It provides a standard SOP for deep analysis of a single SQL, including performance, execution plan, trace package, and lock waits, helping diagnose why a query is slow and how to gather relevant data.

Core Features & Use Cases

  • Single-SQL focus: Analyze one SQL or a small set with trace_id, plans, and locks.
  • Plan and lock diagnostics: Retrieve execution plans, lock wait information, and trace data, and correlate with observer logs.
  • Workflow integration: Works alongside obdiag-performance and observer-log-analysis to form a complete diagnostic workflow.

Quick Start

Run the observer-sql-analysis SOP against a trace_id or SQL_id to start collecting plan, trace, and lock information for a single query.

Frequently Asked Questions about observer-sql-analysis

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I diagnose a slow SQL query in OceanBase using a trace id?

To diagnose a slow SQL query in OceanBase using a trace id, you need a standard SOP that analyzes performance, execution plans, trace packages, and lock waits. This process correlates trace data with observer logs to uncover the root cause of the query latency.

How does execution plan analysis help find the root cause of a slow SQL statement?

Execution plan analysis helps find the root cause of a slow SQL statement by retrieving the query plan and monitoring data. Examining the plan alongside lock wait information reveals performance bottlenecks and explains why the specific query is underperforming.

Can I use obdiag-performance and observer-log-analysis for single SQL diagnostics?

Yes, you can use obdiag-performance and observer-log-analysis for single SQL diagnostics. They integrate directly into the diagnostic workflow to collect trace data, gather plan monitors, and analyze observer logs for a targeted query investigation.

Do I need access to observer and cluster views to analyze a SQL execution plan?

Yes, you need access to observer and cluster views to analyze a SQL execution plan. Accessing these views is required to run db_query for EXPLAIN, gather plan monitors, and retrieve the lock wait information needed for a complete diagnosis.

What is the best way to gather plan monitor data for an OceanBase query?

The best way to gather plan monitor data for an OceanBase query is to run a targeted diagnostic SOP against a specific sql_id or trace_id. This retrieves the execution plan, trace packets, and lock information, presenting the results in a structured format.

Why does my OceanBase SQL execution hang due to locking waits?

Your OceanBase SQL execution hangs due to locking waits when concurrent transactions block each other. Analyzing the trace data and lock wait information for the specific query identifies the blocking sessions and reveals the root cause of the hang.