spanner-graph-query-tuning
БесплатноБез исполняемых скриптовНе проверенTunes and troubleshoots Spanner Graph on Google Cloud ISO GQL queries and execution plans. Use when optimizing slow Spanner Graph GQL queries, diagnosing…
от google★ 25 380 звёзд на GitHubОб этом скилле
Spanner Graph Query Tuning Best Practices
Optimizing ISO GQL queries on Spanner Graph requires aligning pattern matching
and path aggregation with Spanner's distributed query execution engine. Small
syntactic choices in MATCH and NEXT statements can mean the difference
between a targeted index seek (SeekableKeySize: [N]) and a full multi-way
cross apply over millions of intermediate paths.
Usage Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you MUST
read and follow the instructions in
Usage Attribution.
Prerequisites & Cloud Environment Setup
Before profiling or executing queries against a Spanner instance (see
spanner-basics for general Spanner instance provisioning and MCP setup):
- Google Cloud SDK (
gcloud) & Static Analysis Fallback: Verify whether the CLI is installed (do not installgcloudwithout explicit user permission; see Install the Google Cloud SDK). Ifgcloudor live Spanner database access is unavailable, do not block on executinggcloud spanner databases ddl describeor--query-mode=PROFILE—instead, perform static GQL query analysis and rewrites directly using the user-provided query, DDL, or execution plan and the bundledreferences/guides. - Project, Billing & API: Verify an active Google Cloud project with
billing enabled (required even when provisioning a free trial instance) is
configured (
gcloud config set project {project_id}) and, after the user confirms, enable the Spanner API (gcloud services enable spanner.googleapis.com). Ask the user before changing the active project, billing, or enabled APIs, because these commands change the user's Google Cloud environment and can incur costs. - Authentication & Identity and Access Management (IAM) Roles: Authenticate
via
gcloud auth loginorgcloud auth application-default login(orGOOGLE_APPLICATION_CREDENTIALSfor service accounts). Inspecting DDL and profiling queries requiresroles/spanner.databaseReader(orroles/spanner.databaseUser) on{database_id}. - Instance Region, Pricing & Teardown: For test instances, default to
regional-us-central1unless specified otherwise (see Spanner instance configurations, Google Cloud locations, Spanner pricing, and Google Cloud pricing). After benchmarking on temporary test resources, remind the user to delete temporary test databases (gcloud spanner databases delete {database_id} --instance={instance_id}) or test instances (gcloud spanner instances delete {instance_id}) so they do not incur ongoing Spanner compute and storage charges.
Closed-Loop Query Profiling Workflow
Never apply join or index hints blindly. Always inspect the database DDL,
profile the baseline query, apply structural GQL rewrites first, validate
compilation with PLAN, and re-profile to verify latency and scanned rows:
Fetch the schema DDL and profile the baseline query using
gcloud spanner databases ddl describeandgcloud spanner databases execute-sqlwith--query-mode=PROFILE(or--query-mode=PLANif the baseline times out):gcloud spanner databases ddl describe {database_id} --instance={instance_id} gcloud spanner databases execute-sql {database_id} \ --instance={instance_id} \ --query-mode=PROFILE \ --sql="GRAPH MyGraph MATCH ... RETURN ..."Inspect key execution plan metrics (detailed in references/profile-and-hints-guide.md):
- Join Type: Check whether traversal steps use
Distributed Cross Apply(nested-loop index seeks per input row) orHash Join(set-based scan + build/probe). SeekableKeySizevs.Residual Condition: In eachTableScanorIndexScan, check whether predicates are pushed down intoSeekableKeySize: [N](index key seek) or evaluated after scanning as aResidual Condition.- Row Amplification (
Rows Returnedvs.Storage Read): Identify whichMATCHhop causes combinatorial path explosion before a downstream filter orGROUP BY.
- Join Type: Check whether traversal steps use
Apply structural GQL rewrites first (see Core ISO GQL Query Rewrite Rules and references/gql-rewrite-patterns.md) and validate syntax/compilation quickly with
--query-mode=PLAN.Apply statement or element hints only if the optimizer chooses a suboptimal physical plan (see Hint Selection and Guardrails), and re-run
--query-mode=PROFILEto confirm improvement. If
Установить spanner-graph-query-tuning в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл spanner-graph-query-tuning?
Tunes and troubleshoots Spanner Graph on Google Cloud ISO GQL queries and execution plans. Use when optimizing slow Spanner Graph GQL queries, diagnosing distributed cross apply versus hash join execution operators and index seek prefixes, eliminating multi-arm star query Cartesian products with chained query aggregation, bounding super-node fan-out, decorrelating slow subqueries or optional matches, optimizing deep quantified variable-length paths, or applying join method, index, and path factorization query hints. Don't use for relational-to-property-graph schema mapping over existing relational tables (use spanner-relational-to-graph) or physical schema, table, and interleaving design (use spanner-graph-schema-best-practices).
Как установить скилл spanner-graph-query-tuning?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл spanner-graph-query-tuning запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic