/looker-skills:looker-performance-optimizerfrom looker-skills
Diagnoses and refactors slow LookML queries, explores, joins, PDTs, and caching policies. Use when optimizing specific slow explores, query IDs, or dashboard tiles, fixing join fanouts or chasm traps, or refactoring PDTs to incremental materialization.
Ships in looker-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
This master developer skill governs the lifecycle of auditing, diagnosing, and optimizing query performance in new or existing Looker projects. It enforces a strict performance-first design, database caching alignment, strategic data materialization, and advanced SQL profiling using parallel subagents and Looker MCP tools. (When running a full-instance Looker or warehouse diagnostic audit or generating an executive Technical Design Document, start with the looker-healthcheck orchestrator, which delegates active LookML refactoring to this skill and provides warehouse-specific references for Warehouse Compute & Acceleration).
All optimizations developed under this skill must be dialect-agnostic, database-efficient, and preserve the integrity of existing business logic.
This skill operates in two distinct modes to address performance at different stages of the development lifecycle:
Use this mode when adding new explores, views, or Persistent Derived Tables (PDTs) to an existing project. The agent MUST ensure that performance is engineered from the first second:
many_to_one, one_to_one) immediately to prevent compiler-driven Symmetric Aggregations.datagroup triggered by an ETL/ELT metadata query, avoiding arbitrary persist_for time windows.Use this mode when diagnosing and optimizing an active, slow dashboard or explore in production. The agent MUST execute this 5-phase performance pipeline:
EXPLAIN plans concurrently, isolating the database bottlenecks (see Section 6 for delegation rules).looker-cli project validate <project_id> or MCP validate_project) to ensure zero syntax errors, re-execute the queries, and document the performance improvement matrix.Tuning caching is the fastest way to reduce database warehouse costs and accelerate dashboard loads.
persist_for: "24 hours" or similar static durations on explores is strictly prohibited for production environments. It results in stale data and redundant, expensive database queries.datagroup defined in the model file.sql_trigger query that monitors the actual data refresh rate of the warehouse (e.g., querying ETL metadata tables or checking MAX(created_at)).max_cache_age (e.g., 24 hours) as a fallback so that if the ETL pipeline fails to update, the cache eventually expires, ensuring users do not view extremely stale data.When on-the-fly SQL compilation of complex joins and row-level transformations takes too long, the data must be materialized into a Persistent Derived Table (PDT).
Before turning a view or explore into a PDT, the agent MUST evaluate the query using this 4-quadrant decision matrix:
| Metric / Quadrant | Materialize as PDT | Keep as Live Query |
|---|---|---|
| 1. Complexity | Query performs heavy transformations (e.g., complex regex, string parsing, window functions) or multiple join layers, taking >10 seconds to execute. | Query performs simple filters and clean, indexed joins, executing in <3 seconds. |
| 2. Frequency | The explore/dashboard is critical, highly concurrent, and opened hundreds of times daily by business users. | The explore is used sporadically for ad-hoc deep dives by advanced data analysts. |
| 3. Data Freshness | The business requires hourly, daily, or near-real-time updates, which fits standard rebuild schedules. | The business requires absolute, second-level real-time data freshness. |
| 4. Table Size | The underlying raw tables are massive (>50M rows) and lack partition indexes. | The underlying tables are small (<10M rows) and perfectly indexed. |
To prevent massive, historical PDTs (especially Incremental PDTs) from crashing during their initial load due to database timeouts, resource exhaustion, or slot limits, the agent MUST execute this mitigation protocol:
query_sql (or looker-cli query runquery <query_slug> --format sql) and pipe it to bq query --use_legacy_sql=false --dry_run to estimate bytes scanned before materialization.Optimizing the semantic modeling layer eliminates compiler-driven redundancies and ensures the database only processes the minimum required data.
relationship) are accurately declared. If a join is defined as many_to_one but behaves as one_to_many, Looker's compiler will inject expensive _distinct aggregate functions (e.g., SUM_DISTINCT, AVG_DISTINCT) into the SQL, causing massive performance degradation.required_joins parameter to control join paths tightly.sql: parameters that compile into massive SQL CASE WHEN chains is strictly prohibited. These chains cannot be indexed by database engines and result in full table scans. Replace them with clean LookML dimensions or pre-computed PDT columns.To diagnose query performance and run execution plans, the AI agent MUST leverage either the Looker CLI or the Looker MCP server. Looker MCP is preferred for programmatic database introspection.
| Performance Action | Looker CLI Command | Looker MCP Tool |
|---|---|---|
| Fetch Generated SQL | looker-cli query runquery <query_slug> --format sql | query_sql(model, explore, fields) |
| Run Query (Test) | looker-cli query runquery <query_slug> --format json | query(model, explore, fields) or run_dashboard |
| Check Query State | looker-cli api query query_task <query_task_id> | (CLI only — no MCP wrapper for query_task) |
| Database Introspection | looker-cli api metadata connection_columns <conn> --schema_name <schema>(See also: connection_tables, connection_schemas, connection_databases) | get_connection_table_columns(See also: get_connection_tables, get_connection_schemas, get_connection_databases) |
| LookML Compile Check | looker-cli project validate <project_id> | validate_project |
To optimize execution speed, prevent token bloat, and avoid hitting turn or context limits in your agentic environment, follow these execution strategies:
Diagnosing multiple slow dashboard queries generates massive SQL statements, database execution plans, and JSON payloads. To keep the main developer conversation pristine and cost-effective, the main agent MUST delegate diagnostics:
EXPLAIN or EXPLAIN ANALYZE query directly against the target connection (on BigQuery, read the query plan of the job that already ran the query, and run it again only when that job cannot be found; see references/query_diagnostic.md).To protect developer comments, preserve custom dimensions, and optimize API token efficiency, the agent MUST adhere to the following surgical editing protocol:
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
lookml, query-optimization, pdt, caching, looker-performance
27 skills in this plugin
/authenticating-looker-cliLooker Developer Onboarding: Step 3. Authenticates the Looker CLI using OAuth. Only execute this after Step 2 (CLI Verification using `installing-looker-cli`)./connecting-looker-to-bigqueryLooker Developer Onboarding: Step 4. Creates a database connection in Looker to Google BigQuery. Only execute this after Step 3 (CLI Authentication using `authenticating-looker-cli`)./creating-looker-dashboardLooker Developer Onboarding: Step 7 (Final Step). Creates a LookML dashboard in the project, imports it as a user-defined dashboard (UDD) in Looker, and iteratively refines it based on user feedback by syncing changes. Only execute this after Step 6 (Model Setup using `creating-lookml-model`).Generated from the plugin's indexed repository (looker-open-source/looker-skills) — no native marketplace selected
npx claudepluginhub p/looker-open-source-looker-skillsOther plugins' skills for the same job