cloud-native-gcp-bigquery
Use when the user asks about BigQuery cost, bytes scanned, partitioning and clustering, slots and editions, slow BigQuery queries, or Dremel and Capacitor…
от j4flmao★ 47 звёзд на GitHub
Установить cloud-native-gcp-bigquery в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
GCP BigQuery Internals and Optimization
Purpose
BigQuery cost and speed are determined by bytes read and slot time. Knowing how Dremel distributes work and how Capacitor stores columns explains why partitioning, clustering, and column selection matter more than anything else.
Agent Protocol
Trigger
"bigquery", "bigquery cost", "partitioning", "clustering", "dremel", "capacitor", "slots", "editions", "slow query", "bytes scanned".
Input Context
- Table sizes, query patterns (filters, joins, time ranges).
- Pricing model in use (on-demand vs editions reservations).
- Freshness/streaming needs.
Output Artifact
DDL, rewritten SQL, or reservation plan. No file unless requested.
Response Format
Problem: {bytes scanned|slot contention|shuffle/skew|streaming cost}
Change: {DDL/SQL}
Expected effect: {partitions pruned / columns avoided}
Verify with: {dry run bytes, INFORMATION_SCHEMA.JOBS}
Completion Criteria
- Large tables partitioned on the dominant filter column and clustered on secondary filters.
- Cost verified with a dry run or
INFORMATION_SCHEMA.JOBS, not estimated.
Architecture
- Storage/compute separation. Data lives in Colossus (Google's distributed file system) in the Capacitor columnar format; compute is allocated per query as slots (units of CPU/RAM/network).
- Dremel execution. A query becomes a multi-stage plan; stages run in parallel on slots, reading only the referenced columns. Intermediate results are exchanged through a distributed in-memory shuffle tier, which lets stages scale independently.
- Capacitor stores each column separately with encodings (dictionary, run-length, etc.) and per-block metadata (e.g. min/max) used to skip blocks — the basis of clustering's block pruning.
- Network. Jupiter datacenter network lets workers read storage at high bandwidth, so compute does not need to be co-located with data.
flowchart LR
Q[SQL] --> P[Query planner]
P --> S1[Stage 1: scan + filter on slots]
S1 --> SH[(Distributed shuffle)]
SH --> S2[Stage 2: join / aggregate]
S2 --> R[Result]
S1 -.reads columns.-> C[(Capacitor files on Colossus)]
Pricing Models
| Model | You pay for | Fit |
|---|---|---|
| On-demand | Bytes processed per query (logical bytes; first 1 TiB/month free) | Spiky, small/medium usage |
| Editions (Standard, Enterprise, Enterprise Plus) | Slot-hours via reservations with autoscaling (optional baseline / commitments) | Predictable heavy usage, workload isolation |
| Storage | Logical or physical (compressed) bytes, chosen per dataset; long-term rate after 90 days unmodified | Physical billing often cheaper for well-compressed data |
On-demand queries are capped by a per-project concurrent slot quota; heavy concurrency is the usual reason to move to reservations.
Table Design
CREATE TABLE analytics.events
(
event_ts TIMESTAMP NOT NULL,
customer_id STRING,
event_type STRING,
country STRING,
payload JSON
)
PARTITION BY DATE(event_ts)
CLUSTER BY customer_id, event_type
OPTIONS (
require_partition_filter = TRUE,
partition_expiration_days = 400
);
- Partition on a DATE/TIMESTAMP/DATETIME column (time-unit), ingestion time, or integer range. Limit: 10,000 partitions per table — use monthly partitions for long histories at daily granularity.
- Cluster on up to 4 columns, ordered by filter frequency; clustering helps equality/range filters and aggregations on those columns. BigQuery re-clusters automatically in the background at no charge.
- Partitioning gives an accurate dry-run cost estimate; clustering savings appear only at execution.
Query Tuning Rules
| Symptom | Cause | Fix |
|---|---|---|
| Huge bytes billed | SELECT *, no partition filter |
Select needed columns; filter on partition column directly (not wrapped in functions of other columns) |
LIMIT didn't reduce cost |
LIMIT applies after the scan | Filter instead; use table preview for sampling |
| Slow join, "skew" in plan | One key with massive row count | Pre-aggregate, filter nulls/hot keys, or split hot key |
| Repeated identical dashboards | Recomputing aggregates | Materialized views, BI Engine, or scheduled aggregate tables |
| Subquery re-evaluated | Non-deterministic or complex CTE used multiple times | Materialize to a temp table in a multi-statement query |
ORDER BY on large result fails |
Final sort on single worker | Add LIMIT with ORDER BY, or sort downstream |
Inspect cost:
SELECT user_email, query, total_bytes_billed / POW(1024, 4) AS tib_billed, total_slot_ms
FROM `region-eu`.INFORMATION_SCHEMA.JOBS
WHERE creation_time > TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 7 DAY)
AND job_type = 'QUERY'
ORDER BY total_bytes_billed DESC
LIMIT 20;
Dry run: bq query --use_legacy_sql=false --dry_run 'SELECT ...'.
Ingestion
- Batch loads (
bq load, load jobs from GCS) are free of ingestion charges (shared slot pool). - Streaming: use the
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл cloud-native-gcp-bigquery?
Use when the user asks about BigQuery cost, bytes scanned, partitioning and clustering, slots and editions, slow BigQuery queries, or Dremel and Capacitor internals. Produces table designs, query fixes and a pricing-model choice. Not for warehouse vendor comparison (use data-data-warehouse) or dbt projects (use data-science-analytics-engineering).
Как установить скилл cloud-native-gcp-bigquery?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл cloud-native-gcp-bigquery запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…