doris-debug-materialized-view
Use for Doris sync MV (rollup) miss or async MTMV refresh/rewrite issues. Commands: SHOW ALTER TABLE MATERIALIZED VIEW, mv_infos(), EXPLAIN, REFRESH MATERIALIZED VIEW.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 50
- Forks
- 15
01 前言 Front Matter
- name
- doris-debug-materialized-view
- version
- 0.2.0
- category
- materialized-view
- description
- Use for Doris sync MV (rollup) miss or async MTMV refresh/rewrite issues. Commands: SHOW ALTER TABLE MATERIALIZED VIEW, mv_infos(), EXPLAIN, REFRESH MATERIALIZED VIEW.
02 资源文件 1
- 参考文档references/case-001-mtmv-rewrite-miss.md1.4 KB
03 SKILL.md 正文
Materialized View
Kind comparison
| Kind | Code area | Check | Rewrite mechanism |
|---|---|---|---|
| Sync | MaterializedViewHandler / rollup |
SHOW ALTER TABLE MATERIALIZED VIEW |
Transparent — planner auto-selects |
| Async MTMV | fe/.../mtmv/ |
mv_infos() RefreshState |
CBO-based — EXPLAIN shows if matched |
Causes
| ID | Cause | Evidence | Kind |
|---|---|---|---|
| A | Sync MV build pending/stuck | SHOW ALTER TABLE MATERIALIZED VIEW State≠FINISHED |
Sync |
| B | MTMV refresh failed | mv_infos() RefreshState=FAIL |
Async |
| C | MTMV rewrite miss | EXPLAIN shows no MATERIALIZED_REWRITE | Async |
| D | MTMV data stale | mv_infos() LastRefreshTime old |
Async |
| E | MV not selected by planner | EXPLAIN shows TABLE SCAN not MATERIALIZED | Either |
10 min triage
-- Sync MV status
SHOW ALTER TABLE MATERIALIZED VIEW FROM db;
-- Async MTMV status
SELECT * FROM mv_infos('database'='db') WHERE Name='mv'\G
-- Check rewrite eligibility
EXPLAIN VERBOSE SELECT ...;
-- Force refresh
REFRESH MATERIALIZED VIEW mv;
-- Enable external MV rewrite (for catalog queries)
SET materialized_view_rewrite_enable_contain_external_table = true;
Cause C — MTMV rewrite miss
Common reasons (see fe/.../mtmv/MTMVService.java rewrite matcher):
- Partition misalignment: MV has
partition_sync=falseand query partition doesn't match →ALTER MATERIALIZED VIEW mv SET ("partition_sync" = "true") - Aggregation granularity: MV groups by
(a, b)but query groups by(a)only → MV is not a valid rewrite target - Filter mismatch: MV WHERE clause doesn't cover query WHERE clause → check MV definition
- Session var off:
SET enable_materialized_view_rewrite = true
-- Debug: force the optimizer to log MV matching
SET enable_materialized_view_rewrite_debug_log = true;
EXPLAIN VERBOSE SELECT ...; -- check fe/log/fe.audit.log for MV match details
Cause A — Sync MV stuck
-- Cancel stuck build
CANCEL ALTER TABLE MATERIALIZED VIEW FROM db ON table;
-- Check BE compaction queue (MV build competes with compaction)
./scripts/doris-debug be-metrics --be http://$BE:8040 --grep compaction
Source
fe/.../mtmv/MTMVService.java— MTMV lifecyclefe/.../alter/MaterializedViewHandler.java— sync MV alterfe/.../materializedview/MaterializedViewRewriter.java— rewrite logicSessionVariable.java—enable_materialized_view_rewrite,materialized_view_rewrite_enable_contain_external_table
04 同仓库更多 Skills
doris-pr-description
Write, rewrite, or check the title and description of an Apache Doris pull request against the Doris PR standard. Takes the facts from the handoff file that development left when there is one, and collects them from the diff, commits, linked issue, and existing tests otherwise; classifies the PR type, fills that type's required fields, drafts the issue a Feature needs, validates the draft with a bundled checker, and creates or updates the PR on GitHub only after the user confirms. Use whenever the user wants to open, create, submit, or update a Doris PR; write, fix, or improve a PR title or description; prepare a branch for review; rewrite an existing PR's description for comparison; or check whether a description meets the standard. Also use for short requests in any language, such as "open a PR", "write the PR description", or "is this PR description good enough?", even when the standard is not mentioned.
develop-with-evidence
暂无简介
doris-repo-review
Review an Apache Doris PR from a local clone with the same multi-agent, shared-ledger convergence workflow as the CI Code Review Runner. Use when the user supplies a PR to `/doris-repo-review`, asks to review a Doris PR locally, or asks for the CI-style review flow. Safely align only the current worktree to the exact PR head, refuse to disturb tracked local changes, write equivalent English and Chinese review documents with verified path-line anchors, and never build, test, or edit source. Treat a review as pipeline-equivalent only when an explicitly selected qualified reviewer uses a supported effort (xhigh or max, plus ultra for Codex), preferring GPT-6 Astra on Codex and Fable 5.1 on Claude Code. After a converged APPROVE result, automatically post one machine-readable PASS comment bound to the reviewed commit.
doris-profile-reader
Interpret Apache Doris query runtime profiles, especially profile bottleneck triage, misleading wait counters, per-operator metric priority, scan, join-order/runtime-filter analysis, and evidence-bounded performance explanations. Use when given a Doris profile, query id, profile URL/text, or a request to explain Doris query performance.
doris-debug-tablet
Use for Doris tablet/replica health, version skew, clone backlog, disk balance, and tablet repair. Commands: SHOW PROC tablet_health, SHOW TABLET, ADMIN REPAIR.
doris-debug-resource-isolation
Use for Doris Workload Group / resource tag queue starvation, CPU/memory isolation leaks, and workload policy debugging. Commands: SHOW WORKLOAD GROUPS, EXPLAIN resource.