INFORMATION_SCHEMA.INSIGHTS view

Preview

This product or feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of theService Specific Terms. Pre-GA products and features are available "as is" and might have limited support. For more information, see thelaunch stage descriptions.

To request feedback or support for this feature, send email tobq-recommendations+feedback@google.com.

TheINFORMATION_SCHEMA.INSIGHTS view contains insights about all BigQueryrecommendations in the current project. BigQuery retrievesinsights for all BigQuery insight types from the Active Assistand present it in this view. BigQuery insights are alwaysassociated with a recommendation.

TheINFORMATION_SCHEMA.INSIGHTS view supports the followingrecommendations:

Required permission

To view insights with theINFORMATION_SCHEMA.INSIGHTS view, youmust have the required permissions for the corresponding recommender. TheINFORMATION_SCHEMA.INSIGHTS view only returns insights from recommendationsthat you have permission to view.

Ask your administrator to grant access to view insights. To see therequired permissions for each recommender, see the following:

Schema

TheINFORMATION_SCHEMA.INSIGHTS view has the followingschema:

Column nameData typeValue
insight_idSTRINGBase64 encoded ID that contains the insight type and insight ID
insight_typeSTRINGThe type of the Insight. For example,google.bigquery.materializedview.Insight.
subtypeSTRINGThe subtype of the insight.
project_idSTRINGThe ID of the project.
project_numberSTRINGThe number of the project.
descriptionSTRINGThe description about the recommendation.
last_updated_timeTIMESTAMPThis field represents the time when the insight was last refreshed.
categorySTRINGThe optimization category of the impact.
target_resourcesSTRINGFully qualified resource names this insight is targeting.
stateSTRINGThe state of the insight. For a list of possible values, seeValue.
severitySTRINGThe severity of the Insight. For a list of possible values, seeSeverity.
associated_recommendation_idsSTRINGFull recommendation names this insight is associated with. Recommendation name is the Base64 encoded representation of recommender type and the recommendations ID.
additional_detailsRECORDAdditional details about the insight.
  • content: Insight content in JSON format.
  • state_metadata: Metadata about the state of the Insight. Contains key-value pairs.
  • observation_period_seconds: Observation Period for generating the insight.

For stability, we recommend that you explicitly list columns in your information schema queries instead ofusing a wildcard (SELECT *). Explicitly listing columns prevents queries frombreaking if the underlying schema changes.

Scope and syntax

Queries against this view must include aregion qualifier. A project IDis optional. If no project ID is specified, the project that the query runsin is used.

View nameResource scopeRegion scope
[PROJECT_ID.]`region-REGION`.INFORMATION_SCHEMA.INSIGHTS[_BY_PROJECT]Project levelREGION
Replace the following:
  • Optional:PROJECT_ID: the ID of your Google Cloud project. If not specified, the default project is used.
  • REGION: anydataset region name. For example,`region-us`.

    Note: You must usea region qualifier to queryINFORMATION_SCHEMA views. The location of the query execution must match the region of theINFORMATION_SCHEMA view.

Example

To run the query against a project other than your default project, add theproject ID in the following format:

`PROJECT_ID`.`region-REGION_NAME`.INFORMATION_SCHEMA.INSIGHTS
Replace the following:

  • PROJECT_ID: the ID of the project.
  • REGION_NAME: the region for your project.

For example,`myproject`.`region-us`.INFORMATION_SCHEMA.INSIGHTS.

View active insights with cost savings

The following example joins insights view with the recommendations view toreturn 3 recommendations for the insights that are ACTIVE in COST category:

WITHinsightsas(SELECT*FROM`region-us`.INFORMATION_SCHEMA.INSIGHTS),recsas(SELECTrecommender,recommendation_id,additional_detailsFROM`region-us`.INFORMATION_SCHEMA.RECOMMENDATIONS)SELECTrecommender,target_resources,LAX_INT64(recs.additional_details.overview.bytesSavedMonthly)/POW(1024,3)asest_gb_saved_monthly,LAX_INT64(recs.additional_details.overview.slotMsSavedMonthly)/(1000*3600)asslot_hours_saved_monthly,insights.additional_details.observation_period_seconds/86400asobservation_period_days,last_updated_timeFROMinsightsJOINrecsONrecommendation_idinUNNEST(associated_recommendation_ids)WHEREstate='ACTIVE'ANDcategory='COST'LIMIT3;
Note:INFORMATION_SCHEMA view names are case sensitive.

The result is similar to the following:

+---------------------------------------------------+---------------------+--------------------+--------------------------+-------------------------+---------------------+|                    recommender                    |   target_resource   |  gb_saved_monthly  | slot_hours_saved_monthly | observation_period_days |  last_updated_time  |+---------------------------------------------------+---------------------+--------------------+--------------------------+-------------------------+---------------------+| google.bigquery.table.PartitionClusterRecommender | ["table_resource1"] |   3934.07264107652 |       10.499466666666667 |                    30.0 | 2024-07-01 16:41:25 || google.bigquery.table.PartitionClusterRecommender | ["table_resource2"] | 4393.7416711859405 |        56.61476777777777 |                    30.0 | 2024-07-01 16:41:25 || google.bigquery.materializedview.Recommender      | ["project_resource"]| 140805.38289248943 |        9613.139166666666 |                     2.0 | 2024-07-01 13:00:31 |+---------------------------------------------------+---------------------+--------------------+--------------------------+-------------------------+---------------------+

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-15 UTC.