starrocks/starrocks-debug-skills/query
Claude Code and agent skill by starrocks/starrocks-debug-skills
- community
Checking that the SKILL.md file is still in the repository.
Use when queries are slow, hanging, or returning wrong results. Covers the full FE→BE query hang flow, profile-based bottleneck analysis (scan skew, MERGE time dominance, join OOM, runtime filter), predicate pushdown failures, and bug localization via session variable exclusion. Start here for any query performance complaint on a StarRocks cluster.
Install
npx vskill@latest install starrocks/starrocks-debug-skills/querySKILL.md
Query Troubleshooting
Investigation guide for query hangs, slow queries, profile analysis, scan performance, join performance, and bug localization.
Three root causes account for the vast majority of cases:
- Cause A — Network/connection issue (TCP backlog, accept queue saturation)
- Cause B — FE lock / GC blocking (deadlock, full GC pause)
- Cause C — Scan bottleneck (data skew, no predicate pushdown, rowset accumulation)
- Cause D — Join bottleneck (broadcast OOM, missing statistics)
- Cause E — Bug localization (wrong results, executor crash)
Metric Taxonomy — Read This First
Before using any metrics, understand the two-layer observability structure:
FE-side metrics
| Metric / Field | Meaning | |
|---|---|---|
fe.audit.log → QueryTime | End-to-end wall clock time for the query (ms) | |
fe.audit.log → ScanRows | Rows scanned from storage layer | |
fe.audit.log → ScanBytes | Bytes read from storage layer | |
fe.audit.log → MemCostBytes | Peak memory allocated on FE side | |
SHOW PROC '/current_queries' → QueryId | Unique query identifier | |
SHOW PROC '/current_queries' → ConnectionId | Client connection ID | |
SHOW PROC '/current_queries' → ScanRows | Rows scanned so far (live) | |
SHOW PROC '/current_queries' → ProcessRows | Rows processed so far (live) | |
SHOW PROC '/current_queries' → ExecTime | Elapsed execution time (ms) | |
SHOW PROC '/current_queries' → MemUsageBytes | Current memory usage (live) | |
Profile → OLAP_SCAN_NODE | Per-operator timing; entry via SHOW PROFILELIST or FE HTTP UI |
BE-side metrics
| Metric / Field | Meaning | |
|---|---|---|
starrocks_be_tablet_cumulative_max_compaction_score | Max cumulative compaction score on this BE — high value means rowset accumulation, which inflates scan MERGE time | |
Profile → MERGE (aggr/union/sort) | Time spent merging rowsets at scan time; high = compaction lag | |
Profile → IOTime | Disk I/O time at storage layer | |
Profile → JoinRuntimeFilterEvaluate | Number of RuntimeFilters applied; 0 = no filter pushdown |
How to retrieve metrics
Option 1 — FE audit log (historical)
Option 2 — SQL (live, in-flight queries)
Option 3 — Profile (per-query operator breakdown)
Option 4 — BE compaction metrics (scan MERGE time signal)
Key rules for interpretation:
- Always start with
fe.audit.logfor historical slow queries —QueryTimeshows end-to-end latency; correlateScanBytesvsReturnRowsto spot pushdown failures. SHOW PROC '/current_queries'gives live in-flight state;ExecTimeis wall-clock elapsed — compare againstquery_timeoutsetting to judge urgency.- Profile
OLAP_SCAN_NODE Activetime variance across instances reveals data skew — one instance 10× slower than peers is the primary signal. - Profile
MERGEtime as a fraction ofOLAP_SCAN_NODE Activeindicates rowset accumulation — above 50% means compaction is lagging. - If
fe.audit.logshows no entry for the query ID, the FE never received the request — go to Cause A (network/connection).
Query Issue Type Reference
| Symptom | Points to Cause | Quick Confirm | ||
|---|---|---|---|---|
Client hangs, no query ID in fe.audit.log | Cause A — Network/connection | `netstat -s \ | grep TCPBacklogDrop` non-zero | |
Query ID in fe.log but no response; jstack shows lock wait | Cause B — FE lock / GC | jstack <fe_pid> → ConnectProcessor waiting on same lock | ||
Query ID found; one OLAP_SCAN_NODE instance 10× slower | Cause C — Data skew | Profile Active time variance; SHOW TABLET DataSize variance | ||
PushdownPredicates = 0 in profile despite WHERE clause | Cause C — No pushdown | Check column type mismatch or function wrapping on filter | ||
MERGE time > 50% of scan time | Cause C — Rowset accumulation | be_tablets.num_rowset > 50 on scanned table | ||
HASH_JOIN_NODE BuildRows very large; OOM or spill | Cause D — Broadcast OOM | Profile EXCHANGE_NODE → huge right table transfer | ||
| Missing statistics; planner chose wrong join type | Cause D — Missing stats | SELECT * FROM _statistics_.table_statistic_v1 WHERE table_name LIKE '%<name>%' empty | ||
| Wrong results or BE crash | Cause E — Bug | Collect query dump, EXPLAIN COSTS, disable features one by one |
Phase 1 — Confirm Query Is Problematic
Step 1.1 — Check if FE received the request
- Found → FE received the request → proceed to Step 1.2
- Not found → FE never received it → Cause A signal → go to Phase 3, Cause A
Step 1.2 — Check live in-flight state
Step 1.3 — Check audit log for historical pattern
Phase 1 result → route by cause:
| Finding | Next step | |
|---|---|---|
No register query id | Phase 3, Cause A | |
FE log shows query received; jstack shows ConnectProcessor lock | Phase 3, Cause B | |
| Query running slow; profile shows scan variance | Phase 2 (profile analysis) | |
| Query running slow; profile shows large join build | Phase 2 (profile analysis) |
Phase 2 — Locate Bottleneck by Profile
Step 2.1 — Enable and collect profile
Step 2.2 — Read OLAP_SCAN_NODE metrics
Key metrics in OLAP_SCAN_NODE:
| Metric | Meaning | |
|---|---|---|
BytesRead | Data volume read from tablets | |
RowsReturned | Rows returned after filtering | |
RowsReturnedRate | Per-node return rate — variance indicates skew | |
TabletCount | Number of tablets scanned | |
MERGE (aggr/union/sort) | Rowset merge time — high = compaction lag | |
IOTime | Disk I/O time | |
PushdownPredicates | Count of predicates pushed to storage | |
RawRowsRead | Total raw rows before filtering | |
ZoneMapIndexFilterRows / BloomFilterFilterRows / BitmapIndexFilterRows | Rows eliminated by indexes |
Step 2.3 — Identify the bottleneck type
Scan bottleneck signals (→ Cause C):
Join bottleneck signals (→ Cause D):
Step 2.4 — Profile time discrepancy
When total Profile time significantly exceeds BE Active time:
- Check
fe.warn.logfor retry logs. - Primary Key model (older versions): lock acquisition timeout — look for gap between prepare and open.
- Optimizer too slow — verify with
explain; or jstack to see if stuck in plan generation. - Import lock interference — import holds DB lock, blocking query lock acquisition.
- FE Full GC — check
fe.gc.logtimestamps.
Phase 3 — Take Action by Cause
Cause A — Network / Connection Issue
Confirm all match:
- No
register query identry infe.logfor the query netstat -s | grep TCPBacklogDropshows non-zero and growingss -lntshowsRecv-Q≈ backlog limit on FE port 9030
Mechanism: When connection burst exceeds the OS TCP listen queue (controlled by somaxconn), new SYN packets are silently dropped. The FE ConnectProcessor never sees the connection and logs nothing. The client receives a connection timeout with no error from FE.
Fix:
- Set
tcp_abort_on_overflowto 1 (returns RST instead of silent drop — easier to diagnose) - Increase
somaxconn(at least 1024) - Adjust FE parameters:
mysql_nio_backlog_num,http_backlog_num,thrift_backlog_num(must be ≥somaxconn) - Restart FE after parameter change
→ Go to Phase 4 to verify recovery
Cause B — FE Lock / GC Blocking
Confirm all match:
register query idpresent infe.logbut query never dispatched to BEjstack <fe_pid>showsConnectProcessorthreads waiting on same lock object address- OR
fe.gc.logshows Full GC events aligned with the hang window
Mechanism (lock): Two query threads acquire FE DB locks in different orders, creating a circular wait. All subsequent queries needing either lock queue behind blocked threads. FE heartbeat stays alive but no fragments are dispatched.
Mechanism (GC): Full GC pauses the JVM for seconds or minutes, freezing all FE threads. All pending queries appear hung during the pause.
Action: capture multiple jstack dumps, then restart FE.
If BE received it → issue is on BE side → check pstack / execution thread pool (Step 1.6 in original guide).
→ Go to Phase 4 to verify recovery
Cause C — Scan Bottleneck
C1: Data Skew
Confirm all match:
- Profile shows one
OLAP_SCAN_NODEinstance Active time 10× higher than peers SHOW TABLET FROM <table>shows DataSize variance > 10× across tablets
Mechanism: Low-cardinality bucket key (e.g., status, region) concentrates majority of rows in one or few tablets. All queries on hot range land on one scan instance. BE CPU on hot node saturates; others idle. Query latency is dominated by the slowest straggler scan instance.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingquery/SKILL.md
Popularity
- Repository stars
- 78
- Repository forks
- 14
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/starrocks/starrocks-debug-skills/query)