BLOG

BigQuery Optimizations (Query List)

bigquery optimizations query list

Table of contents

Primer on BigQuery Cost and Performance Optimizations

Overview

bigquery optimizations query list

How to Read This List

The Query List

  • billing_recommendation_per_query.sql
    Returns each query in the time period with a recommendation on if the query would run more efficiently under a flat-rate or on-demand billing plan. This is built around slot count and bytes scanned to determine a recommendation.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • concurrent_queries_by_minute.sql
    Builds a time-series over the interval on a per-minute basis and returns the number of concurrent queries that were run during that time frame.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • concurrent_queries_by_second.sql
    Builds a time-series over the interval on a per-second basis and returns the number of concurrent queries that were run during that time frame.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • general_job_information.sql
    Returns a subset of general information for each job run during the timeframe.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • load_job_information.sql
    Returns general information for each load job run during the timeframe.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • load_slots_per_minute.sql
    Builds a time-series over the interval on a per-minute basis and returns the number of slots used by load jobs that were run during that time frame.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • load_slots_per_second.sql
    Builds a time-series over the interval on a per-second basis and returns the number of slots used by load jobs that were run during that time frame.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • longest_running_queries.sql
    Returns all queries run over the interval and their pricing data sorted by the longest running queries to the shortest.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • looker_job_information.sql
    Returns general information for each job run during the timeframe that was associated with a Looker service account.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • query_counts.sql
    Returns every query run during the time frame along with the count of runs as well sorted by most runs to least runs.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • query_job_information.sql
    Returns general information for each query job run during the timeframe.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • query_slots_per_minute.sql
    Builds a time-series over the interval on a per-minute basis and returns the number of slots used by query jobs that were run during that time frame.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • query_slots_per_second.sql
    Builds a time-series over the interval on a per-second basis and returns the number of slots used by query jobs that were run during that time frame.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • slots_by_day.sql
    Builds a time-series over the interval on a per-day basis and returns the number of slots used by all jobs that were run during that time frame.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • slots_by_hour.sql
    Builds a time-series over the interval on a per-hour basis and returns the number of slots used by all jobs that were run during that time frame.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • slots_by_minute.sql
    Builds a time-series over the interval on a per-minutes basis and returns the number of slots used by all jobs that were run during that time frame.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • slots_by_minute_and_user.sql
    Builds a time-series over the interval on a per-minute basis and returns the number of slots used by all jobs that were run during that time frame and grouping them by the user running them.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • slots_by_second.sql
    Builds a time-series over the interval on a per-seconds basis and returns the number of slots used by all jobs that were run during that time frame.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • table_query_counts.sql
    Returns the number of jobs that hit a table during the specified time frame. Note that if a table exists and isnโ€™t hit by any jobs it will not appear in this query.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • top_billed_labels.sql
    Returns the costs on a per-label basis that is applied to jobs over the specified time frame. This list is sorted from most expensive labels to least.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • top_billed_queries.sql
    Returns the query jobs run over the specified time frame sorted by their billed cost from most expensive to least.
    Noteย that this may contain duplicates if a job is run multiple times with the same parameters.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • top_billed_queries_deduplicated.sql
    Returns the query jobs run over the specified time frame sorted by their billed cost from most expensive to least.
    Noteย this jobย willย deduplicate jobs and return only a single row per job. It will run significantly slower than the above query.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • top_complex_queries.sql
    Returns query jobs sorted by the most complex to least complex. Complexity is defined as how many slots were used to complete processing.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • top_cost_users.sql
    Returns the users that initiated jobs and how much they spent ordered by most cost to least cost.ย Noteย this will also contain service accounts.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General
  • top_costly_queries.sql
    Returns the query jobs run over the specified time frame with their total cost accounting for multiple runs in the cost calculation. Results are sorted from the most expensive to least.
    -ย INFORMATION_SCHEMA
    -ย Audit Log
    -ย Audit Log General

Schedule a call with our team

You will receive a calendar invite to the email address provided below for a 15-minute call with one of our team members to discuss your needs.

You will be presented with date and time options on the next step