Bigtable Basics
GoogleOfficialPublished by Google
- Skill
- Tool integration
- Data and AI
- Apache-2.0
- No issues found
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
Bigtable-basics provides essential guidance for managing Google Bigtable instances, tables, and data. It covers control plane operations via gcloud, data plane tasks using the cbt CLI, and best practices for schema design, row key optimization, and performance troubleshooting. The skill emphasizes high-performance patterns, including the use of Key Visualizer for diagnostics and selecting appropriate client libraries for production workloads.
What it does
- Guides the provisioning of Bigtable instances, clusters, and tables.
- Provides patterns for designing performant row keys and column families.
- Facilitates data reading and writing using cbt and SQL interfaces.
- Offers workflows for diagnosing performance issues and hotspotting.
- Includes instructions for schema evolution and garbage collection policy management.
- Ensures proper usage attribution for CLI commands.
When to use it
- When setting up or modifying Bigtable infrastructure and schemas.
- When writing or debugging client application code for Bigtable.
- When performing manual data validation or quick lookups via CLI.
- When investigating performance bottlenecks or table hotspots.
- When planning for complex data access patterns using materialized views.
Advantages
- Promotes performance-first design principles for NoSQL data modeling.
- Clearly distinguishes between control plane and data plane operations.
- Provides actionable diagnostic workflows for identifying slow queries.
- Standardizes CLI usage with required attribution tracking.
Usage examples
- “How do I create a new column family with a specific garbage collection policy?”
- The agent provides the cbt createfamily and cbt setgcpolicy commands with the correct syntax for setting max versions and age.
- “I am seeing performance issues. How can I diagnose hotspotting?”
- The agent instructs the user to use Key Visualizer in the Cloud Console and explains how to use cbt read with stats to identify slow queries.
- “How do I read a single row efficiently?”
- The agent recommends using the cbt lookup command for point reads instead of a full table scan.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/google/bigtable-basics/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip bigtable-basics.zip -d .agents/skills
Documentation by Google
Bigtable Basics
This skill provides core workflows and guidance for administering and developing with Google Bigtable.
Attribution
MUST READ: Before executing any gcloud, REST API, or MCP command, you
MUST read Usage Attribution. For commands executed
directly in the terminal (never in generated scripts, Terraform, or user code),
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.
Core Principles
Control Plane vs. Data Plane:
Use
gcloudfor Control Plane operations: Manage Instances, Clusters, App Profiles, Backups and IAM. Create Tables, Logical Views, Materialized Views and Authorized Views.Use
cbtfor Data Plane operations: Update Tables, Column Families, and reading/writing data.
Performance First: Bigtable is a NoSQL database. Efficiency is tied to Row Key design. Always warn about Full Table Scans.
Client Selection: For production use cases, prefer Java or Go for their superior performance and feature coverage compared to other languages.
Observability: When diagnosing performance or hotspotting, always mention Key Visualizer (via Cloud Console) as the primary diagnostic tool because it provides the most granular view of access patterns across row keys. This should be followed by the hot-tablets tool and table stats in gcloud CLI and
include-stats=fulloption undercbt readto diagnose slow queries.
[!IMPORTANT] Safety Rule: You MUST obtain explicit user confirmation before making non-emulator database changes. You MUST mention this safety requirement when providing commands or instructions that modify the database structure or data.
Quick Recipes
1. Querying Data
Use SQL for complex transforms or aggregations and key-value APIs for simpler
query patterns. Note: Use exact match, prefix (_key LIKE 'myprefix%'), or
range predicates on _key to avoid expensive unbounded scans. Recommend
explicit row ranges (_key BETWEEN 'start' AND 'end') as a more performant
alternative to prefix matches where possible.
If expensive scans (either unbounded or prefix or range queries scanning a large range) are unavoidable due to multiple access patterns that can’t all be accommodated in a single schema, consider one of these two options:
If the query will be used in user facing and/or latency sensitive applications, use continuous materialized views with keys optimized for the additional access patterns.
If secondary access patterns are infrequent, batch patterns like ETL, ML model training or analytical read-only tasks, use Bigtable Data Boost instead.
2. Manipulating Data
Use key-value APIs for insert, update, increment and delete operations. SQL API is read-only.
3. Data Model Definition (DDL)
SQL API doesn't support DDL operations. Table creation, deletion, updates should be made using gcloud CLI. Logical Views and Continuous Materialized Views are defined as SQL queries but they must be created using gcloud CLI.
Reference Guides
CLI Operations:
infrastructure_management.md: Provisioning instances, clusters, and table schemas.
cli_data_access.md: Reading and writing data via the
cbtCLI.
Design & Discovery:
schema_design.md: Best practices for row keys and performance with tables and continuous materialized views.
dataplex.md: Data catalog search for Bigtable assets.
Querying & Code:
sql_guide.md: Querying structured row keys via SQL and CLI.
client_libraries.md: Patterns for high-performance Go/Java/Python code.
Common Workflows
Schema Evolution (DevOps)
Prefer Terraform for production schema changes to prevent accidental data loss.
For manual
cbtchanges, first check the existing state by listing the table's column families and GC policies before proposing any modifications:cbt ls {table}If modifications are needed, create the family or update the GC policy:
cbt createfamily {table} {family} cbt setgcpolicy {table} {family} "maxversions=5 AND maxage=30d"Reference infrastructure_management.md for full syntax.
External Resources
Files
- ATTRIBUTION.mdAdded by AutoGineer848 B
- LICENSELicence file added by AutoGineer11.1 KiB
- SKILL.md5.5 KiB
- assets/row_key_schema.yaml205 B
- references/attribution.md1.8 KiB
- references/cli_data_access.md1.6 KiB
- references/client_libraries.md2.3 KiB
- references/dataplex.md911 B
- references/infrastructure_management.md3.4 KiB
- references/schema_design.md7.9 KiB
- references/sql_guide.md7.4 KiB
references/schema_design.md
Bigtable Schema Design Guide for Agents
This document provides guidelines for designing performant schemas.
Table of Contents
Key concepts [L15-L40]
Defining the Row Key Template [L42-L63]
Structured Row Keys [L65-L106]
Row Key Design & Hotspotting [L108-L128]
Counters for real-time metrics [L130-L135]
Materialized views [L137-L178]
Performance Checklist (Agent Verification) [L180-L197]
Key concepts
Row key: Bigtable stores data lexicographically by row key. For best performance queries should be designed to filter by row key in its entirety or prefix. Point lookups by row key or reading ranges starting with a key will be the most performant. Row keys can have multiple parts combined using a delimiter, typically following a hierarchical format such as
category#subcategory#productIDas inapparel#shoes#0123. Bigtable doesn't support multi-row transactions but changes within a row are transactional. When designing schemas put data that needs to be updated transactionally within the same row.Column Families: Group data that is accessed together within a row. Defined as part of the schema. Contents of a family can easily be deleted in bulk with a single command for a given row key.
Column Qualifiers: Defined at write time. Each row can have as many unique qualifiers within the row size limits (256 MB) with no limit on number of qualifiers per table. Qualifiers can be used in two ways: 1. as attributes in a JSON document e.g.
zipcode,city,state,street addressor 2. to store data like affinity scores e.g.0.9,0.7for different products or web pages they visited e.g.home,search,cart.Timestamps: Are used for versioning. They are not system timestamps. They are user-defined and often used for event times like a sensor reading, address change timestamp or date a social media post was written. They can be used to expire items using TTL or move them to cold storage for cost savings as well as time-travel queries to find the "as of" state of a record.
Defining the Row Key Template
Since Bigtable treats row keys as opaque bytes, defining a Row Key Template is a manual design process based on your use case. To ensure consistency when programmatically interacting with data, your application code must implement a mechanism (such as string formatting or concatenation) to construct and parse these keys.
1. The Template Format
Define your keys using a placeholder syntax:
{tenant_id}#{entity_type}#{reversed_timestamp}#{uuid}
2. Implementation Pattern
Use centralized factory functions to construct keys.
Java:
String.format("%s#%s#%d#%s", tenantId, entity, Long.MAX_VALUE - ts, uuid)Go:
fmt.Sprintf("%s#%s#%d#%s", tenantID, entity, math.MaxInt64-ts, uuid)
3. Delimiter Selection
Use #, :, or |. Ensure delimiters don't appear in the field data.
Structured Row Keys
Bigtable supports Structured Row Keys to define the structure of your row keys. This metadata helps external tools (like BigQuery) and the Bigtable SQL interface understand how to parse your keys.
Why use Structured Row Keys?
Automatic Parsing: SQL queries can reference individual segments by name instead of using string functions.
Integration: Improves the experience when querying Bigtable from BigQuery or Spark.
Validation: Helps prevent malformed keys.
Managing via gcloud
You can define the structure when creating a table or update an existing one:
gcloud bigtable instances tables update {table_id} \
--instance=${BIGTABLE_INSTANCE} \
--row-key-schema-definition-file={row_key_schema_definition_file}Where {row_key_schema_definition_file} is a YAML file. A template is provided
in assets/row_key_schema.yaml. You can copy this template to create your
schema definition.
Row Key Design & Hotspotting
If row keys are autoincrement or are prefixed by date or timestamp, all writes will hit a single node, creating a "hotspot" and taxing the overall system performance. Bigtable's in-memory tier addresses hotspotting for reads (e.g. trending content on social media) but keys should be designed by keeping writes in mind.
Distribution Strategy
To ensure high performance, agents must validate that row keys are designed for high cardinality.
Avoid: Sequential timestamps at the start of the key.
Prefer: Prefixes to divide up the key space or reversed timestamps (e.g.,
tenantID#reversedTimestamp#objectID).
Field Salting Example
If a user must use a low-cardinality prefix, recommend "salting" the key:
salt = hash(original_key) % number_of_nodes new_row_key = salt + "#" + original_key
Counters for real-time metrics
For frequent updates on single row metrics e.g. number of ad views, social media post likes, API calls or daily unique viewers (using data sketches like HLL), create an aggregate family to use Bigtable counters for much higher throughput and lower latency compared to read-modify-write.
Materialized views
For real-time analytics
Materialized views can be used for real-time aggregations across one or more rows for any type of data including aggregate families (note that approximate count distinct sketches will need to be aggregated using HLL_COUNT.MERGE). Frequently used metrics can be pre-aggregated efficiently as these views are incrementally maintained, then further filtered and aggregated at read time using SQL. Telemetry, merchant analytics, ad performance monitoring and real-time features for machine learning are some common use cases. Below is an example query that can be used as a materialized view that returns hourly count of messages in each chat room for a messaging application that has chatroom's unique identifier as the first row key token.
SELECT SPLIT(_key, '#')[0] AS chatroom, TIMESTAMP_TRUNC(_timestamp, HOUR) AS time_bucket,
COUNT(_key) AS total_messages FROM UNPACK((SELECT * FROM messages(WITH_HISTORY=>TRUE)))
GROUP BY 1, 2For secondary indexing
Materialized views can be used as asynchronous global secondary indexes. Given
the wide range of SQL functions supported, even geospatial index (using
S2_CELLIDFROMPOINT) and inverted index use cases can be served with
materialized views. Below is an example of an inverted index that allows fast
search for rows that have occurrences of a given word in any of its cells in
user_profile family or in a particular qualifier .
SELECT
u.value AS indexed_value,
u.key AS indexed_qualifier,
ARRAY_AGG(_key) AS user_keys
FROM users, UNNEST(MAP_ENTRIES(user_profile)) u
GROUP BY 1,2Filtering this index view for just indexed_value returns all occurrences in
the form of an array of row keys from the users table while using both
indexed_value and indexed_qualifier returns results for only that qualifier.
Performance Checklist (Agent Verification)
When reviewing or generating schema-related code, verify the following:
[ ] Row Key Size: Must be < 4KB (Ideal: 10–100 bytes). Large keys increase memory pressure and disk usage.
[ ] Uniqueness: Ensure row keys are globally unique. Duplicate keys will overwrite existing data.
[ ] Character Set: Use
^[a-zA-Z0-9\-_#]+$. Stick to alphanumeric, underscores, and hashes. Zero pad all numbers to ensure correct string sorting.[ ] Column Qualifier Size: Keep < 16 KB to minimize storage footprint.
[ ] Column Family Count: Limit to < 100 families. Keep names short.
[ ] Cell Field Size: Keep < 10 MB (100 MB is the hard limit). Larger cells slow down retrieval.
[ ] Row Size: Keep < 100 MB. Note that Bigtable enforces a hard limit of 256 MB at read time.
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Security
No issues found by our static scan· No issues found
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Publisher
- Google (Official)
- Source
- google/skills · skills/cloud/bigtable-basics · commit 2194d3b
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Google or Google.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download bigtable-basics.zip