materialized-view

materialized-view is a skill for Claude Code, Codex from StarRocks/starrocks-debug-skills. It costs 77 tokens per session (5,441 once invoked), scanned A, original, Apache-2.0.

A troubleshooting guide for asynchronous materialized views. A materialized view is a stored query result that is refreshed from source tables to speed up later queries.

In plain words
What is it for?
Use it to inspect refresh errors, memory and timeout problems, inactive views, query-rewrite behavior, staleness settings, and scheduler issues after a frontend restart.
Why use it?
It helps identify why refreshes fail or time out, views become inactive, or the database does not use an eligible view to rewrite a query.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/starrocks/starrocks-debug-skills/materialized-view
Any agent
npx skills add StarRocks/starrocks-debug-skills --skill materialized-view
Clone the repo
git clone --depth 1 https://github.com/StarRocks/starrocks-debug-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for materialized-view

README.md
[![agentmods](https://agentmods.dev/badge/skills/starrocks/starrocks-debug-skills/materialized-view.svg)](https://agentmods.dev/skills/starrocks/starrocks-debug-skills/materialized-view)
Your own site
<a href="https://agentmods.dev/skills/starrocks/starrocks-debug-skills/materialized-view"><img src="https://agentmods.dev/badge/skills/starrocks/starrocks-debug-skills/materialized-view.svg" alt="Measured on agentmods" height="20"></a>
Per session 77 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,441 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00077 $0.05441
Opus 5 $0.00039 $0.02721
Sonnet 5 $0.00015 $0.01088
Haiku 4.5 $0.00008 $0.00544

Measured 6d ago against content hash 07a40847b5a7, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

materialized-view scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

materialized-view/SKILL.md · 663 lines

How it starts

The opening of the file, as written. The whole thing — 663 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Materialized View Troubleshooting

Investigation guide for async MV refresh failures, refresh timeouts, MV inactivation, query rewrite failures, and sync MV optimization.

Five root causes account for the vast majority of cases:

  • Cause A — refresh OOM (memory exhaustion during materialization)
  • Cause B — refresh timeout (SQL takes longer than configured limit)
  • Cause C — MV inactive (base table schema change or manual deactivation)
  • Cause D — query rewrite not used (structural mismatch, staleness, or disabled)
  • Cause E — schedule persistence issue (FE restart breaks scheduler timing)

Metric Taxonomy — Read This First

Before using any metrics, understand the three observability layers:

MV state observability

SHOW MATERIALIZED VIEWS — primary MV health check:

Field Meaning
is_active Whether the MV is active (true = can refresh and rewrite)
last_refresh_state State of the last refresh: SUCCESS, FAILED, RUNNING
last_refresh_error_message Error detail when last_refresh_state = FAILED
last_refresh_time Timestamp of the last completed refresh
last_refresh_duration_ms Duration of the last refresh in milliseconds
inactive_reason Why the MV was deactivated (schema change, explicit call)
refresh_type ASYNC / MANUAL / SCHEDULED
next_refresh_time Next scheduled refresh (for scheduled MVs)

Refresh task observability

-- Refresh history with error details
SELECT task_name, state, error_message, start_time, finish_time,
       TIMESTAMPDIFF(SECOND, start_time, finish_time) AS duration_sec
FROM information_schema.task_runs
WHERE task_name LIKE 'mv-%'
ORDER BY start_time DESC LIMIT 20;

-- Running refresh tasks right now
SELECT * FROM information_schema.task_runs
WHERE state = 'RUNNING';

Resource consumption observability

-- Queries running during refresh (to identify resource contention)
SHOW PROC '/current_queries' \G

-- Analyze a specific refresh profile (get profile_id from task_runs)
ANALYZE PROFILE FROM '<profile_id>';

Read the full file on GitHub · 663 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 663 lines · 77 tokens per session scan A 07a40847b5a7

Subscribe to this mod's changes

materialized-view is a skill published in the GitHub repository StarRocks/starrocks-debug-skills (75 stars, last pushed 3mo ago), licensed Apache-2.0. It adds 77 tokens to every session and 5,441 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

doris-debug-materialized-view

Use for Doris sync MV (rollup) miss or async MTMV refresh/rewrite issues. Commands: SHOW ALTER TABLE MATERIALIZED VIEW, mvinfos(), EXPLAIN, REFRESH MATERIALIZED VIEW.

apache/doris-skills · 48 tokens

fix-failing-tests

Diagnose a failing test in the googleapis/mcp-toolbox repo and land a fix by reasoning from the actual error: read the failure, reproduce it, shrink it until the cause is forced into the open, then fix the cause. Use this whenever a test or CI job is red, a build breaks after a change, many packages fail at once, or a…

googleapis/mcp-toolbox · 87 tokens

triage-issues

Triage GitHub issues in the googleapis/mcp-toolbox repo: propose the correct labels (type / priority / product / status), check for duplicates, verify a bug has enough info to act on, and draft a triage comment. Use whenever a maintainer asks you to triage, label, categorize, prioritize, or "look at" an issue (or a…

googleapis/mcp-toolbox · 164 tokens

postgresql-indexing

PostgreSQL indexing best practices for Prowler: index design, partial indexes, partitioned table indexing, EXPLAIN ANALYZE validation, concurrent operations, monitoring, and maintenance. Trigger: When creating or modifying PostgreSQL indexes, analyzing query performance with EXPLAIN, debugging slow queries, reviewing…

prowler-cloud/prowler · 108 tokens

graphjin-eval

Create, extend, run, baseline, and diagnose GraphJin agent evaluations through the graphjin eval CLI.

dosco/graphjin · 27 tokens

django-perf-review

Django performance code review. Use when asked to "review Django performance", "find N+1 queries", "optimize Django", "check queryset performance", "database performance", "Django ORM issues", or audit Django code for performance problems.

getsentry/skills · 55 tokens