跳到主要内容
知仓学习社ZHICANG

spanner-basics

>-

不碰外部(只输出文字)无严重或高危命中google/skills

它会碰到什么

扫了多少9 个文本文件,17 KB
它会碰到什么不碰外部(只输出文字)
命中总数0 处
命中统计严重 0 · 高 0 · 中 0 · 低 0

这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。

技能内容

Spanner Basics

This skill provides core workflows and guidance for administering and developing with Google Cloud Spanner, a fully managed, mission-critical database service offering global transactional consistency and automatic, synchronous replication for high availability.

Core Principles

  • Performance First: Spanner scales horizontally. Efficiency is tied to

Primary Key design. Always warn against using monotonically increasing/decreasing

values (like sequential timestamps) as the first part of a primary key to avoid hotspots.

  • Schema Design: Prefer interleaved tables for strongly related parent-child data

that is frequently accessed together.

Safety

> [!CAUTION] CRITICAL INSTRUCTION: You MUST obtain explicit user confirmation before making any non-emulator database changes (DML or DDL) or destructive operations (such as dropping tables, indexes, or any other Spanner resources). Do not execute them automatically; instead, output the command (e.g., gcloud spanner databases ddl update) and ask for explicit user approval.

> When database access is unavailable or authentication fails, do not block on trying to verify the existence of the instance, database, or table. Assume the provided resources exist and directly generate the DDL commands.

Common Workflows

Schema Evolution & DDL

  1. Use gcloud spanner databases ddl update to apply schema updates (such as CREATE, ALTER, or DROP tables and indexes).
  2. Reference [schema-design.md](references/schema-design.md) for guidelines on primary key selection and interleaved tables.

Diagnosing Performance Issues

  1. Use SPANNER_SYS tables to identify slow or resource-intensive queries.
  2. For example, query SPANNER_SYS.QUERY_STATS_TOP_HOUR to find queries with the highest CPU usage.

Reference Directory

  • [Core Concepts](references/core-concepts.md): Explanation of Spanner internals, architecture, and design.
  • [CLI Usage](references/cli-usage.md): Essential gcloud spanner command-line operations for managing instances and databases.
  • [IAM Security](references/iam-security.md): Roles, permissions, and data governance best practices for Spanner.
  • [Client Library Usage](references/client-library-usage.md): Using Google Cloud client libraries for Spanner (Java, Go, Python, Node.js).
  • [Terraform Usage](references/terraform-usage.md): Infrastructure as Code examples for provisioning Spanner instances and databases.
  • [MCP Usage](references/mcp-usage.md): Using the Spanner remote MCP server.
  • [PostgreSQL Dialect](references/postgresql-dialect.md): Best practices and examples for using the PostgreSQL interface in Spanner.
  • [Schema Design](references/schema-design.md): Guidelines on primary key selection and interleaved tables for performance.

If you need product information that's not found in these references, use the

search_documents tool of the Developer Knowledge MCP server.

想直接用这个技能?

本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。