{"data":{"slug":"github-google-skills-skills-cloud-bigtable-basics-2db516b49cd1","title":"Bigtable Schema Design and Query Optimization","summary":"Design efficient Bigtable schemas, configure column families, and optimize queries using row keys and SQL for structured data. Receive guidance on diagnosing performance issues and hotspots, with deliverables including schema configurations and query optimizations.","url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-cloud-bigtable-basics-2db516b49cd1","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-google-skills-skills-cloud-bigtable-basics-2db516b49cd1","markdown_url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-cloud-bigtable-basics-2db516b49cd1.md","download_url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-cloud-bigtable-basics-2db516b49cd1\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"Before executing any `gcloud`, REST API, or MCP command, you must read [Usage Attribution](references\/attribution.md). For terminal commands, prefix `gcloud` with `CLOUDSDK_METRICS_REQUEST_ATTRIBUTION=\"agent-skills\/1.0 (skill:bigtable-basics)\"` and append `agent-skills\/1.0 (skill:bigtable-basics)` to `User-Agent` headers. Always obtain explicit user confirmation before making non-emulator database changes.","instructions":"---\nname: bigtable-basics\nmetadata:\n  version: \"1.0.1\"\n  category: Databases\ndescription: >-\n  Assists in provisioning instances\/tables, designing performant schemas, and querying data in Bigtable. Use when designing Bigtable row keys, configuring column families, writing SQL queries or client library code (Java, Go, Python) for Bigtable, or diagnosing performance\/hotspotting issues. Also use when provisioning Bigtable clusters using gcloud or cbt CLIs. Don't use for generic Cloud SQL administration.\n---\n\n# Bigtable Basics\n\nThis skill provides core workflows and guidance for administering and developing\nwith Google Bigtable.\n\n## Attribution\n\n**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you\nMUST read [Usage Attribution](references\/attribution.md). For commands executed\ndirectly in the terminal (never in generated scripts, Terraform, or user code),\nprefix `gcloud` with\n`CLOUDSDK_METRICS_REQUEST_ATTRIBUTION=\"agent-skills\/1.0 (skill:bigtable-basics)\"`\nand append `agent-skills\/1.0 (skill:bigtable-basics)` to `User-Agent` headers.\n\n## Core Principles\n\n-   **Control Plane vs. Data Plane:**\n    -   Use **`gcloud`** for Control Plane operations: Manage Instances,\n        Clusters, App Profiles, Backups and IAM. Create Tables, Logical Views,\n        Materialized Views and Authorized Views.\n    -   Use **`cbt`** for Data Plane operations: Update Tables, Column Families,\n        and reading\/writing data.\n-   **Performance First:** Bigtable is a NoSQL database. Efficiency is tied to\n    Row Key design. Always warn about Full Table Scans.\n-   **Client Selection:** For production use cases, prefer **Java** or **Go**\n    for their superior performance and feature coverage compared to other\n    languages.\n-   **Observability:** When diagnosing performance or hotspotting, **always**\n    mention **Key Visualizer** (via Cloud Console) as the primary diagnostic\n    tool because it provides the most granular view of access patterns across\n    row keys. This should be followed by the hot-tablets tool and table stats\n    in gcloud CLI and `include-stats=full` option under `cbt read` to diagnose\n    slow queries.\n\n> [!IMPORTANT] **Safety Rule:** You MUST obtain explicit user confirmation before\n> making non-emulator database changes. You MUST mention this safety requirement\n> when providing commands or instructions that modify the database structure or\n> data.\n\n## Quick Recipes\n\n### 1. Querying Data\n\nUse SQL for complex transforms or aggregations and key-value APIs for simpler\nquery patterns. *Note: Use exact match, prefix (`_key LIKE 'myprefix%'`), or\nrange predicates on `_key` to avoid expensive unbounded scans. Recommend\nexplicit row ranges (`_key BETWEEN 'start' AND 'end'`) as a more performant\nalternative to prefix matches where possible.*\n\nIf expensive scans (either unbounded or prefix or range queries scanning a large\nrange) are unavoidable due to multiple access patterns that can\u2019t all be\naccommodated in a single schema, consider one of these two options:\n\n-   If the query will be used in user facing and\/or latency sensitive\n    applications, use continuous materialized views with keys optimized for the\n    additional access patterns.\n-   If secondary access patterns are infrequent, batch patterns like ETL, ML\n    model training or analytical read-only tasks, use Bigtable Data Boost\n    instead.\n\n### 2. Manipulating Data\n\nUse key-value APIs for insert, update, increment and delete operations. SQL API\nis read-only.\n\n### 3. Data Model Definition (DDL)\n\nSQL API doesn't support DDL operations. Table creation, deletion, updates should\nbe made using gcloud CLI. Logical Views and Continuous Materialized Views are\ndefined as SQL queries but they must be created using gcloud CLI.\n\n## Reference Guides\n\n-   **CLI Operations**:\n    -   [infrastructure_management.md](references\/infrastructure_management.md):\n        Provisioning instances, clusters, and table schemas.\n    -   [cli_data_access.md](references\/cli_data_access.md): Reading and writing\n        data via the `cbt` CLI.\n-   **Design & Discovery**:\n    -   [schema_design.md](references\/schema_design.md): Best practices for row\n        keys and performance with tables and continuous materialized views.\n    -   [dataplex.md](references\/dataplex.md): Data catalog search for Bigtable\n        assets.\n-   **Querying & Code**:\n    -   [sql_guide.md](references\/sql_guide.md): Querying structured row keys\n        via SQL and CLI.\n    -   [client_libraries.md](references\/client_libraries.md): Patterns for\n        high-performance Go\/Java\/Python code.\n\n## Common Workflows\n\n### Schema Evolution (DevOps)\n\n1.  **Prefer Terraform** for production schema changes to prevent accidental\n    data loss.\n2.  For manual `cbt` changes, first check the existing state by listing the table's column families and GC policies before proposing any modifications:\n\n    ```bash\n    cbt ls {table}\n    ```\n\n    If modifications are needed, create the family or update the GC policy:\n\n    ```bash\n    cbt createfamily {table} {family}\n    cbt setgcpolicy {table} {family} \"maxversions=5 AND maxage=30d\"\n    ```\n\n3.  Reference\n    [infrastructure_management.md](references\/infrastructure_management.md) for\n    full syntax.\n\n## External Resources\n\n*   [Cloud Bigtable Documentation](https:\/\/cloud.google.com\/bigtable\/docs)\n*   [Bigtable SQL Reference](https:\/\/cloud.google.com\/bigtable\/docs\/googlesql-overview)\n*   [cbt CLI Reference](https:\/\/cloud.google.com\/bigtable\/docs\/cbt-reference)\n*   [gcloud bigtable Reference](https:\/\/cloud.google.com\/sdk\/gcloud\/reference\/bigtable)\n","use_cases":["Designing row keys for efficient data access","Configuring column families and garbage collection policies","Writing SQL queries for structured row keys","Diagnosing performance issues and hotspots"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/google\/skills\/blob\/e3c591afe426ea585e4c21799e5199d6d47cd1be\/skills\/cloud\/bigtable-basics\/SKILL.md","source_commit":"e3c591afe426ea585e4c21799e5199d6d47cd1be","license":null,"version":null,"listing_approved_at":"2026-11-17","created_at":"2026-11-16T12:39:32.000000Z","updated_at":"2026-11-17T05:10:16.000000Z","seo_title":"Bigtable Schema Design and Query Optimization","seo_description":"Learn how to design Bigtable schemas, optimize queries, and improve performance with row keys and column families.","seo_keywords":["Bigtable schema design","Bigtable row key optimization","Bigtable query performance","Bigtable column family configuration","Bigtable performance diagnostics"]}}