{"data":{"slug":"github-google-skills-skills-cloud-bigquery-observability-2f05fc69d0ff","title":"BigQuery Telemetry Retrieval & Analysis","summary":"Retrieve and analyze BigQuery telemetry data using REST API, CLI, and INFORMATION_SCHEMA queries for diagnosing single-job performance bottlenecks, investigating slot contention, and analyzing reservation capacity for cost optimization.","url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-cloud-bigquery-observability-2f05fc69d0ff","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-google-skills-skills-cloud-bigquery-observability-2f05fc69d0ff","markdown_url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-cloud-bigquery-observability-2f05fc69d0ff.md","download_url":"https:\/\/skillshunter.net\/skills\/github-google-skills-skills-cloud-bigquery-observability-2f05fc69d0ff\/download","category":{"slug":"data-research","name":"Data & Research"},"editor_note":"Before executing any `gcloud`, REST API, or MCP command, you must read [Usage Attribution](references\/attribution.md). For commands executed directly in the terminal, prefix `gcloud` with `CLOUDSDK_METRICS_REQUEST_ATTRIBUTION=\"agent-skills\/1.0 (skill:bigquery-observability)\"` and append `agent-skills\/1.0 (skill:bigquery-observability)` to `User-Agent` headers.","instructions":"---\nname: bigquery-observability\nmetadata:\n  version: \"1.2.2\"\n  category: BigDataAndAnalytics\ndescription: >-\n  Provides data-retrieval best practices, tool selection guidance, and\n  performant SQL query syntax for BigQuery telemetry across INFORMATION_SCHEMA,\n  Cloud Monitoring, and the REST API. Use when the telemetry to fetch is already\n  known, selecting telemetry tools, writing performant INFORMATION_SCHEMA\n  queries, retrieving telemetry for diagnosing single-job performance\n  bottlenecks, investigating slot contention, job concurrency and queue latency,\n  analyzing reservation capacity, utilization and autoscaling saturation, or\n  auditing capacity-based and on-demand compute and storage resource billable\n  usage. Don't use for root-cause diagnosis or symptom troubleshooting when the\n  cause is unknown (use bigquery-troubleshooting first), or for writing or\n  optimizing business logic SQL (use bigquery-optimization).\n---\n\n# BigQuery Observability\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:bigquery-observability)\"`\nand append `agent-skills\/1.0 (skill:bigquery-observability)` to `User-Agent` headers.\n\n## Tool Selection\n\n<!-- mdformat off -->\n\n| Tool | Primary Use Cases | Strengths & Capabilities | When to Avoid \/ Limitations |\n| --- | --- | --- | --- |\n| **`INFORMATION_SCHEMA` (`I_S`)** | Historical analysis, cohort comparison (`normalized_literals`), discovery of fast\/slow windows, reservation\/project timelines, multi-job aggregates, cost\/billing tracing. | Flexible SQL querying across `JOBS`, `JOBS_TIMELINE`, and `RESERVATIONS`; supports custom time windows and grouping. | Avoid for high-frequency real-time polling or single-job point-lookups (can consume slots and take seconds to execute). |\n| **REST API (`jobs.api` \/ `reservation.api`)** | Single-job point-lookup, real-time stage bottleneck diagnosis, automated pipeline status checks, reservation\/capacity commitment configuration inspection (`reservations.get`, `reservations.list`). | Zero-SQL overhead, fast REST\/CLI point-lookups (`bq show -j`, `bq show --reservation`), instant access to `performanceInsights`, `queryPlan`, and structural metadata. | Avoid for aggregate analysis across thousands of jobs, cross-project historical comparison, or system timeline aggregations. |\n| **`Cloud Monitoring` (Metrics Explorer \/ Charts)** | Real-time alerting, fleet-wide dashboards, continuous slot utilization tracking, high-level SLA\/SLO monitoring. | Out-of-the-box charts for slot utilization, query throughput, `PENDING` queue depth, and execution latency; low-latency alerting without running queries. | Avoid for SQL-level debugging, individual query text inspection, or stage-level execution detail. |\n\n<!-- mdformat on -->\n\n## Prerequisites & Environment Setup\n\nBefore retrieving telemetry or running observability queries, ensure the\nGoogle Cloud environment and project are configured:\n\n1.  **Google Cloud SDK**: Ensure the\n    [Google Cloud SDK](https:\/\/cloud.google.com\/sdk\/docs\/install) is installed\n    and configured.\n2.  **Project Selection**: Set the active Google Cloud project:\n\n    ```bash\n    gcloud config set project {project_id}\n    ```\n\n3.  **API Enablement**: Ensure the BigQuery and Cloud Monitoring APIs are\n    enabled:\n\n    ```bash\n    gcloud services enable bigquery.googleapis.com monitoring.googleapis.com\n    ```\n\n4.  **Authentication**: Authenticate the environment:\n    *   CLI queries and `bq` commands: `gcloud auth login`\n    *   SDKs and automated client tools:\n        `gcloud auth application-default login`\n    *   Service accounts: Set\n        `GOOGLE_APPLICATION_CREDENTIALS=\"\/path\/to\/key.json\"`\n\n5.  **Billing & IAM Roles**:\n    *   Verify an active Google Cloud Billing account is attached to\n        `{project_id}`.\n    *   Ensure appropriate IAM roles:\n        *   `roles\/bigquery.jobUser`: Running telemetry queries.\n        *   `roles\/bigquery.resourceViewer` or `roles\/bigquery.admin`:\n            Organization-level jobs and reservation telemetry.\n        *   `roles\/monitoring.viewer`: Cloud Monitoring metrics.\n\n6.  **Companion Skills Installation**:\n    This skill is part of a 3-pillar operations suite (`bigquery-observability`,\n    `bigquery-optimization`, `bigquery-troubleshooting`). If any companion skill\n    is not yet installed in your environment, install the full suite:\n\n    ```bash\n    npx skills add google\/skills --skill bigquery-observability --skill bigquery-optimization --skill bigquery-troubleshooting\n    ```\n\n## Workflow\n\n1.  **Single-Job Point-Lookup (Zero-SQL Overhead):** For single-job slowness or\n    inspection, always prioritize the REST API or CLI (`bq show -j`) first. It\n    provides zero-SQL overhead and fast point-lookups for internal stage\n    bottlenecks (`performanceInsights`, `queryPlan`, shuffle spill).\n\n    ```bash\n    bq show --location={location} -j {project_id}:{job_id}\n    ```\n\n2.  **Diagnostic Transition Logic:** If no job-level issues are found (e.g. no\n    clear internal bottlenecks), the investigation should transition to\n    system-level `INFORMATION_SCHEMA` queries (such as `JOBS_TIMELINE` or\n    `RESERVATIONS_TIMELINE`) to check for broader issues like slot contention,\n    queueing delay, or noisy neighbors.\n\n## Best Practices for Writing `INFORMATION_SCHEMA` Queries\n\nEvery query against a BigQuery `INFORMATION_SCHEMA` view must be qualified with\neither a **region qualifier** or a **dataset qualifier**, optionally prefixed by\na **project qualifier**.\n\n### Qualification Syntax & Scope Matching\n\n1.  **Region-Qualified Syntax:**\n\n    ```googlesql\n    `{project_id}`.`region-{region}`.INFORMATION_SCHEMA.{view}\n    ```\n\n    *Example:* `` `my-project`.`region-us`.INFORMATION_SCHEMA.JOBS``\n\n    *Applies to:* Regional telemetry views (`JOBS*`, `JOBS_TIMELINE*`,\n    `RESERVATIONS*`, `CAPACITY_COMMITMENTS*`, `TABLE_STORAGE*`,\n    `STREAMING_TIMELINE*`). The client query execution location MUST match the\n    `region-{region}` qualifier (or BigQuery throws: `Not found: Table\n    {project_id}:region-{region}.INFORMATION_SCHEMA.{view} was not found in\n    location {location}`).\n\n2.  **Dataset-Qualified Syntax:**\n\n    ```googlesql\n    `{project_id}`.`{dataset_id}`.INFORMATION_SCHEMA.{view}\n    ```\n\n    *Example:* `` `my-project`.`analytics`.INFORMATION_SCHEMA.TABLES``\n\n    *Applies to:* Dataset-scoped views (`PARTITIONS`, `SEARCH_INDEXES*`).\n    Never use `region-` with dataset views.\n\n3.  **Dual-Scoped Views:** Views like `TABLES`, `COLUMNS`, `COLUMN_FIELD_PATHS`,\n    `VIEWS`, `ROUTINES`, and `VECTOR_INDEXES` can be qualified with either\n    `{dataset_id}` or `region-{region}` depending on whether dataset or\n    region-wide analysis is required.\n\n4.  **Project Qualifier (`{project_id}`):** Optional. If omitted, queries\n    default to the project in which the query is executing. Specifying a project\n    qualifier on organization-level views (e.g. `JOBS_BY_ORGANIZATION`) has no\n    impact on results.\n\n### Principle of Least Privilege & Scope Selection\n\nWhen constructing `INFORMATION_SCHEMA` queries, **always select the scope and\nview variant with the least IAM permission requirement** that satisfies the\nanalytical need:\n\n1.  **User-Level over Project-Level (`_BY_USER`):** When diagnosing queries or\n    sessions executed by the current user, use `_BY_USER` (e.g. `JOBS_BY_USER`,\n    `SESSIONS_BY_USER`). This requires only `bigquery.jobs.list` (granted via\n    `roles\/bigquery.user` or `roles\/bigquery.jobUser`), avoiding the need for\n    `bigquery.jobs.listAll` or `roles\/bigquery.admin`.\n2.  **Dataset-Level over Region\/Project-Level:** When querying table metadata,\n    columns, or views for a specific dataset, qualify with `{dataset_id}` rather\n    than `region-{region}` when project-level metadata access is restricted.\n    Dataset-scoped queries require permissions only on that target dataset.\n3.  **Project-Level over Org\/Folder-Level (`_BY_PROJECT`):** Always start with\n    project-scoped views before escalating to `_BY_FOLDER` or\n    `_BY_ORGANIZATION`. Folder and organization queries require broad folder\/org\n    IAM permissions (`bigquery.jobs.listAll` or `bigquery.tables.list` at the\n    Org\/Folder node).\n4.  **Metadata Roles over Data Roles:** For table and storage introspection,\n    prefer `roles\/bigquery.metadataViewer` (which provides `bigquery.tables.get`\n    and `bigquery.tables.list`) over `roles\/bigquery.dataViewer` or\n    `roles\/bigquery.dataOwner` when data read access (`bigquery.tables.getData`)\n    is not needed. (Note: `INFORMATION_SCHEMA.PARTITIONS` uniquely requires\n    `bigquery.tables.getData`).\n\n### Execution Guardrails & Query Invariants\n\n*   **Mandatory Partition & Time Filtering:** Always filter on `creation_time`\n    (e.g., `creation_time >= TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 3\n    DAY)`) or `usage_date` to avoid full metadata table scans.\n*   **Script Wrapper Exclusion:** Add `AND (statement_type != 'SCRIPT' OR\n    statement_type IS NULL)` when aggregating compute spend to avoid\n    double-counting parent scripts and child jobs.\n*   **Column Pruning:** Never use `SELECT *` against `INFORMATION_SCHEMA`; only\n    project required columns.\n*   **Dry Run & Cost Estimation:** Use a dry run (`bq query --dry_run\n    --use_legacy_sql=false \"{query}\"` or API `dryRun=true`) before executing\n    complex queries, multi-view joins, or large scans to validate syntax and\n    estimate `totalBytesProcessed` at zero cost.\n*   **Empty Regional Scope (0 Rows):** If the execution location matches the\n    qualifier, but the project has no datasets or jobs in that region, the query\n    succeeds and returns **0 rows**. Never assume 0 rows means 0 usage\u2014always\n    verify the target dataset locations.\n*   **Non-Hierarchical Region Scope:** Region qualifiers are not hierarchical.\n    Multi-regions do not encompass single regions (e.g. `region-us` returns only\n    multi-region `US` metadata and does not include single regions like\n    `region-us-central1`).\n*   **No Multi-Region Aggregation in SQL:** Region qualifiers cannot be joined\n    cross-region in a single query (e.g. `region-us` cannot join `region-eu`).\n*   **Uncached Execution & Minimum Scan Size:** `INFORMATION_SCHEMA` query\n    results are never cached. On-demand queries incur a minimum of 10 MB of data\n    processing charges per execution.\n\n## Domain References & SQL Queries\n\n### Telemetry Query Guides\n\n*   **On-Demand Compute: Billed Bytes**\n    (`references\/compute_ondemand_billable.md`): Authoritative Golden CTE\n    (`bytes_billed_cte`), timezone-aligned billing date extraction (PST8PDT),\n    BQML CREATE_MODEL 50x multiplier rules, script wrapper deduplication, and\n    row-level security (RLS) masking checks.\n*   **Capacity Compute: Billable Slots & Commitments**\n    (`references\/compute_capacity_billable.md`): Query templates for auditing\n    billable capacity hours across 1-Year\/3-Year commitments, uncovered baseline\n    PAYG slots, and dynamic autoscaling hours.\n*   **Storage Footprints & Usage (Bytes Stored)**\n    (`references\/storage_footprints.md`): Storage snapshot queries, compression\n    ratio calculations, Time Travel \/ Fail-Safe churn, daily average GiB\n    time-integrals, billing model evaluation, and search index coverage.\n\n### Performance & Troubleshooting Guides\n\n*   **Job Performance Queries** (`references\/job_performance_queries.md`):\n    Queries for evaluating individual and aggregate job performance, stage\n    bottleneck flags, comparable jobs via normalized literals\n    (`query_info.query_hashes.normalized_literals`), BI Engine acceleration,\n    metadata cache (cmeta) acceleration, search index usage, materialized view\n    rewrite usage, and execution variance outliers.\n*   **Resource Contention Queries**\n    (`references\/resource_contention_queries.md`): Queries for diagnosing slot\n    contention, queue latency, per-minute concurrency\/queue timelines, and\n    1-second reservation slot saturation.\n*   **Capacity & Configuration Queries**\n    (`references\/capacity_and_configuration_queries.md`): Queries for evaluating\n    second-by-second baseline\/max capacity ceilings, autoscaling saturation\n    timelines, and auditing configuration changes\n    (`RESERVATION_CHANGES_BY_PROJECT`, `ASSIGNMENT_CHANGES_BY_PROJECT`).\n\n### Schema Dictionaries (Column Definitions & Units)\n\n*   **Compute & Capacity Schema Dictionary** (`references\/schema_compute.md`):\n    Complete column dictionary, physical units, and least-privilege IAM roles\n    for all compute, job, session, reservation, capacity commitment, and\n    assignment views (`JOBS*`, `JOBS_TIMELINE*`, `SESSIONS_BY_USER`,\n    `SESSIONS_BY_PROJECT`, `RESERVATIONS*`, `RESERVATION_CHANGES*`,\n    `RESERVATIONS_TIMELINE*`, `CAPACITY_COMMITMENTS*`,\n    `CAPACITY_COMMITMENT_CHANGES_BY_PROJECT`, `ASSIGNMENTS*`,\n    `ASSIGNMENT_CHANGES_BY_PROJECT`).\n*   **Storage & Data Catalog Schema Dictionary**\n    (`references\/schema_storage.md`): Complete column dictionary, physical\n    units, and least-privilege IAM roles for all table storage, partition,\n    column, snapshot, dataset, constraint, and replication views\n    (`TABLE_STORAGE*`, `TABLE_STORAGE_USAGE_TIMELINE*`, `TABLES*`,\n    `TABLE_OPTIONS`, `COLUMNS`, `COLUMN_FIELD_PATHS`, `PARTITIONS`, `VIEWS`,\n    `MATERIALIZED_VIEWS`, `TABLE_SNAPSHOTS`, `TABLE_CONSTRAINTS`,\n    `KEY_COLUMN_USAGE`, `SCHEMATA*`, `SCHEMATA_OPTIONS`, `SCHEMATA_REPLICAS*`,\n    `SCHEMATA_LINKS`, `SHARED_DATASET_USAGE`).\n*   **Platform, Governance & Ingestion Schema Dictionary**\n    (`references\/schema_others.md`): Complete column dictionary, physical units,\n    and least-privilege IAM roles for all remaining views including Access\n    Control (`OBJECT_PRIVILEGES`), Streaming Ingestion\n    (`STREAMING_TIMELINE_BY_PROJECT*`, `WRITE_API_TIMELINE_BY_PROJECT*`),\n    Configuration Options (`PROJECT_OPTIONS*`, `EFFECTIVE_PROJECT_OPTIONS`,\n    `ORGANIZATION_OPTIONS*`, `ORGANIZATION_OPTIONS_CHANGES`), Insights &\n    Recommendations (`RECOMMENDATIONS*`, `INSIGHTS`), and Indexes\/BI\n    Engine\/Routines (`SEARCH_INDEXES*`, `SEARCH_INDEX_COLUMNS`,\n    `SEARCH_INDEX_OPTIONS`, `VECTOR_INDEXES*`, `VECTOR_INDEX_COLUMNS`,\n    `VECTOR_INDEX_OPTIONS`, `BI_CAPACITIES`, `BI_CAPACITY_CHANGES`, `ROUTINES*`,\n    `ROUTINE_OPTIONS`, `PARAMETERS`).\n","use_cases":["Diagnose single-job performance bottlenecks using REST API or CLI","Investigate slot contention and queue latency with INFORMATION_SCHEMA queries","Analyze reservation capacity and autoscaling saturation for cost optimization"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/google\/skills\/blob\/e3c591afe426ea585e4c21799e5199d6d47cd1be\/skills\/cloud\/bigquery-observability\/SKILL.md","source_commit":"e3c591afe426ea585e4c21799e5199d6d47cd1be","license":null,"version":null,"listing_approved_at":"2026-11-17","created_at":"2026-11-16T12:46:14.000000Z","updated_at":"2026-11-17T05:10:16.000000Z","seo_title":"BigQuery Telemetry Retrieval & Analysis","seo_description":"Efficiently retrieve and analyze BigQuery telemetry data for performance diagnostics and resource optimization using SQL, REST API, and Cloud Monitoring.","seo_keywords":["BigQuery telemetry retrieval","BigQuery performance diagnostics","BigQuery INFORMATION_SCHEMA queries","Cloud Monitoring telemetry analysis","BigQuery job performance analysis"]}}