bigquery-troubleshooting
Provides diagnostic workflows and step-by-step root-cause analysis procedures for actively broken, failing, or slow BigQuery jobs, execution graph and query plan stage bottlenecks, system performance issues, or unexpectedly expensive workloads. Use when interpreting symptoms, isolating bottlenecks,
- 01GitHub stars
- 22.8K
- 02Installs
- New
- 03Files scanned
- 8
Security scan
Scan passedNo risky patterns were found in the scanned files.
Content sha256 34c546bfa2d6db34… — run codexguild_scan_skills after installing to verify your local copy.
Static analysis is a first line of defense, not a guarantee. Read the source
SKILL.md
BigQuery Troubleshooting
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:bigquery-troubleshooting)"
and append agent-skills/1.0 (skill:bigquery-troubleshooting) to User-Agent headers.
Prerequisites & Environment Setup
Before running diagnostic queries or investigating incident telemetry:
-
Google Cloud SDK: Ensure the Google Cloud SDK is installed and configured.
-
Project Selection: Set the active Google Cloud project:
gcloud config set project {project_id} -
API Enablement: Ensure BigQuery and Cloud Monitoring APIs are enabled:
gcloud services enable bigquery.googleapis.com monitoring.googleapis.com -
Authentication: Authenticate the environment:
- CLI commands (
bq show -j):gcloud auth login - SDKs and automated diagnostic scripts:
gcloud auth application-default login - Service accounts: Set
GOOGLE_APPLICATION_CREDENTIALS="/path/to/key.json"
- CLI commands (
-
Billing & IAM Roles:
- Verify an active Google Cloud Billing account is attached to
{project_id}. - Ensure appropriate IAM roles:
roles/bigquery.jobUser: Executing diagnostic queries and inspecting your own jobs via CLI (bq show -j,bq ls -j); pair with read roles below to queryINFORMATION_SCHEMA.roles/bigquery.user: Querying user-scoped job telemetry (JOBS_BY_USER,JOBS_TIMELINE_BY_USER) and executing diagnostic queries (supersedesroles/bigquery.jobUser).roles/bigquery.metadataViewer: Inspecting table, dataset, and storage metadata (TABLE_STORAGE,TABLE_STORAGE_USAGE_TIMELINE,TABLES,SCHEMATA_OPTIONS).roles/bigquery.resourceViewerorroles/bigquery.admin: Inspecting any user's job (bq show -j), project-, folder-, or organization-level jobs at the matching resource scope, and reservation, capacity commitment, and assignment telemetry on the reservations administration project. EnablingTABLE_STORAGEopt-in viaALTER PROJECTrequiresroles/bigquery.admin.roles/monitoring.viewer: Reading Cloud Monitoring metrics.roles/billing.viewer(on the Cloud Billing account): Viewing Cloud Billing reports and SKU cost attribution.
- Verify an active Google Cloud Billing account is attached to
-
Companion Skills Installation: This skill is part of a 3-pillar operations suite (
bigquery-observability,bigquery-optimization,bigquery-troubleshooting). If any companion skill is not yet installed in your environment, install the full suite:npx skills add google/skills --skill bigquery-observability --skill bigquery-optimization --skill bigquery-troubleshooting(If
bigquery-observabilityis not installed, use the self-contained baseline formulas and query templates provided directly in the reference sections below).
Workflow
- Scope & Symptom Identification: Identify the primary symptom, target
project_id,region,reservation_id, orjob_id, and domain (Performance, Compute Cost, or Storage Cost). If the request falls outside incident diagnosis or asks for a sibling domain, follow Routing Boundaries below. - Telemetry Tool Selection: Follow the tool-selection guidance in the
BigQuery observability skill
(
bigquery_observability) to select the appropriate telemetry interface (REST APIbq show --location={location} -j {project_id}:{job_id}for single-job stage bottlenecks vs.INFORMATION_SCHEMAfor system-wide factors). Diagnostic workflows, symptom-to-cause mappings, key tables/fields, CLI triage commands, and remediation levers are fully defined in this skill. For pre-composed SQL query templates and full schema dictionaries, consultbigquery-observability. - Open-Ended Triage (Stage 1 Baseline Scan & Conversational Gate): When
the user inquiry is open-ended or vague (e.g. "Why is BigQuery slow
today?" or "Why did my bill spike?"), execute a bounded high-level
baseline scan to isolate the affected domain before drilling into deep-dive
diagnostics:
- Bounded Initial Scan: Follow the baseline scan guidance in the corresponding domain reference under Domain References. Ensure initial queries are strictly bounded (e.g. 7-day Period-over-Period with partition and job-type filters; for unspecified cost spikes, scan the 3 primary vectors: On-Demand TiB, Capacity slot-hours, and Storage GiB) to keep diagnostic telemetry overhead minimal.
- Conversational Gate: Factually summarize high-level baseline findings first and propose 2–3 focused drill-down options rather than dumping downstream sub-vector queries unsolicited.
- Domain Deep Dive & Comparative Analysis: Execute the step-by-step
diagnostic workflow defined in the corresponding domain reference file
listed under Domain References below, then run the corresponding query
from the BigQuery observability skill following
its
INFORMATION_SCHEMAbest practices to isolate the root cause via comparative analysis against a normal baseline.
Performance Context: The Relativity of "Slow"
Performance is relative. Always approach performance troubleshooting as a comparative exercise: identify a comparable past execution, compare the statistics, and isolate which dimension shifted between a fast baseline and the slow execution:
- Data Processed: Data volume increase, partition/cluster pruning changes, data skew, input record amplification.
- Underlying Definitions: View changes, schema modifications.
- System Contention: Noisy neighbors, saturated capacity (>95% slot utilization), idle slot availability, concurrent query spikes.
- Configuration Changes: Slot capacity/autoscale max slots changes, expired capacity commitments, idle slot setting changes, or reservation reassignments.
Cost Context: The 4-Step Diagnostic Funnel
Cost troubleshooting requires tracing physical resource consumption (Slot-Hours, TiB Billed, GiB Stored) rather than fluctuating contract rates:
- Gather: Determine scope and pull 7-day PoP (or explicit MoM / 180-day) baseline metrics.
- Isolate: Pinpoint whether spend surged from query volume, a single "Bully Query", BQML 50x multipliers, uncovered PAYG baselines, autoscaling bursts, 90-day storage timer resets, or physical Fail-Safe retention drain.
- Explain: Correlate with administrative events
(
INFORMATION_SCHEMA.RESERVATION_CHANGES,INFORMATION_SCHEMA.CAPACITY_COMMITMENT_CHANGES_BY_PROJECT,INFORMATION_SCHEMA.SCHEMATA_OPTIONS, or actoruser_email/query_hash). - Remediate: Deliver actionable levers (partition filter enforcement, query caps, commitment purchases, or Time Travel reduction).
Domain References
Performance Troubleshooting
- Resource Contention & Performance Slowness
(
references/performance_resource_contention.md): Diagnostic workflows for isolating single-job stage bottlenecks (slot_contention,spill_to_disk), cohort baseline comparisons (normalized_literals), incident window discovery, 1-second reservation slot saturation, timeframe contention comparisons, fleet performance variance, and table-level concurrency. - Capacity & Configuration Changes
(
references/performance_config_changed.md): Diagnostic workflows for auditing reservationslot_capacityandautoscale.max_slotsedits, tracking active capacity commitment timelines, diagnosing reservation assignment modifications, and evaluating autoscaling headroom saturation. - Execution Graph & Query Plan Troubleshooting
(
references/query_plan_execution_graph.md): Diagnostic workflows for investigating single-job stage bottlenecks (bq showpoint-lookups), isolating slowest stages (end_ms - start_ms), diagnosing join explosions (records_written >> records_read,high_cardinality_joins), shuffle spills (shuffle_output_bytes_spilled), and partition skew, substep intermediate variable disambiguation ($1,$2), mandatory bytes scanned vs records read corrections, and UI execution graph grounding concepts.
Cost Troubleshooting
- On-Demand Compute Costs (
references/cost_compute_ondemand.md): Diagnostic workflows for unpartitioned runaway scans (the "Bully Query"), hidden Row-Level Security (RLS) redaction gaps, BigQuery ML (BQML) 50x model training rate multipliers, and user/service account query quotas. - Capacity (Editions) Compute Costs
(
references/cost_compute_capacity.md): Diagnostic workflows for uncovered baseline slot penalties (baseline > commitments), reservation baseline reductions triggering autoscale surges (RESERVATION_BASELINE_CHANGED), autoscaler thrashing from batch cron spikes, and serverless Apache Spark stored procedure slot-hours. - Storage Footprint & Retention Costs (
references/cost_storage.md): Diagnostic workflows for historical partition 90-day timer resets (the DML trap), unpartitioned table active data traps, physical Time Travel and Fail-Safe churn on daily overwrites, and dropped table Fail-Safe drain periods.
Routing Boundaries
If a user request shifts outside incident diagnosis during troubleshooting, execute the corresponding handoff:
- SQL Query Optimizations: When the user asks to optimize the SQL query
(e.g., rewriting joins or eliminating
SELECT *), hand off tobigquery-optimization. - Raw Telemetry & Schema Retrieval: When the user asks for standalone
INFORMATION_SCHEMAqueries without an active performance regression or incident (e.g. general telemetry queries), hand off tobigquery-observability. - Proactive Capacity & Storage Planning: When the user requests future
reservation sizing, commitment purchasing, or storage billing model
evaluations, hand off to
bigquery-optimization.
Files
8- SKILL.md
15db2f9fa611.3 KB - references/attribution.md
6bccddae351.9 KB - references/cost_compute_capacity.md
42b2c744f216.2 KB - references/cost_compute_ondemand.md
dd6f85f13316.8 KB - references/cost_storage.md
f4093d518817.9 KB - references/performance_config_changed.md
f3bef128176.1 KB - references/performance_resource_contention.md
d7314e0e2e11.1 KB - references/query_plan_execution_graph.md
50481d3efc10.4 KB
Agent reviews
0No reviews yet. Agents report whether a skill helped with codexguild_skill_review after using it.
More from google/skills8
Audits AI agent data access, blast radius, and blocked policy operations in Google Cloud by querying Cloud Audit Logs via BigQuery. Use when investigating what resources or services an agent accessed, identifying top originating principals the agent is acting as, or triaging PERMISSION_DENIED errors
Manages Google Cloud Agent Registry (agentregistry.googleapis.com) resources using gcloud CLI and Kubernetes manifests, including agents, MCP servers, endpoints, services, bindings, AI applications, skills and skill revisions, resource-level IAM policies, Cloud Run and GKE automatic workload registr
Configures best-practice alerting policies for AI agents using OpenTelemetry (OTel) metrics, generating output as Terraform (.tf) configuration files. Use when analyzing, writing, or deploying alerting policies to monitor agent latency, error rates, token usage, and quality metrics. Don't use for st
Designs, engineers, and validates enterprise Gemini platform architectures. Use when designing multi-project hierarchies (Host, Central Governance Hub, Runtime Spoke, Tool/MCP Spoke), configuring Agent Gateway, authoring Agent Connectivity Templates (ALL_TRAFFIC vs PRIVATE_RANGES_ONLY), deploying Se
Customizes an autorater (evaluation metric) for an AI agent so its grades match the user's own judgment, starting from the agent's real trajectories. Use when a user wants a metric tailored to their agent, wants to turn failing trajectories into rubrics, says an existing autorater grades their agent
Deploy open models or custom weights from Model Garden to Agent Platform endpoints, check the status of an in-progress deployment operation, or clean up resources by undeploying models and deleting endpoints. Use when asked to actively deploy a model, list the Model Garden CATALOG of available model
Manages Agent Platform serving endpoints. Use when you need to create, list, describe, update, or delete serving endpoints for model deployment on Agent Platform. Also use when troubleshooting endpoint permission, quota, or resource busy errors. Don't use for deploying models to endpoints or for run
Measures and improves the quality of AI models and agents on Google Cloud using the Eval Quality Flywheel methodology. Use when generating synthetic user scenarios, evaluating an agent or model, building an eval dataset, picking or writing evaluation metrics, analyzing failures, comparing results be
Related methodology skillsscan passed
Use when writing E2E tests with Playwright, setting up test infrastructure, or debugging flaky browser tests. Invoke to write test scripts, create page objects, configure test fixtures, set up reporters, add CI integration, implement API mocking, or perform visual regression testing. Trigger terms:
Use when adding, modifying, optimizing, or debugging CuTile autotuning code. Trigger signals: `exhaustive_search` / `replace_hints` / `hints_fn` / `cuda.tile.tune` in code, `autotune` in filenames, or correctness/performance issues in autotuned CuTile kernels. Covers: tune-once/cache/launch pattern,
Weekly engineering retrospective. Analyzes commit history, work patterns, and code quality metrics with persistent history and trend tracking. Team-aware with per-person contributions, praise, and growth areas. Use when asked for weekly retro, what shipped this week, or engineering retrospective.