A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/bigquery/docs/materialized-views-intro below:

Introduction to materialized views | BigQuery

Stay organized with collections Save and categorize content based on your preferences.

Introduction to materialized views

Materialized views are precomputed views that periodically store the results of a SQL query. Materialized views can reduce the total processing time and charges related to querying by storing query results, reducing the amount of data to be scanned for each query. BigQuery verifies that materialized views provide fresh data by computing updates in the background. This process is performed incrementally by using only the changed data in the base table, subject to a number of considerations. Materialized views can be either queried directly or used by BigQuery to optimize queries to their base tables.

Key characteristics of materialized views include the following:

Use cases

Materialized views can optimize queries with high computation cost and small dataset results. Processes that benefit from materialized views include online analytical processing (OLAP) operations that require significant processing with predictable and repeated queries like those in from extract, transform, load (ETL) processes or business intelligence (BI) pipelines.

The following use cases highlight the value of materialized views. Materialized views can improve query performance if you frequently require the following:

Smart-tuning

Materialized views can be used to transparently improve the performance of queries without modifying them. You can use a materialized view to optimize sets of queries with common patterns, such as those generated by a BI tool. For more information see Use materialized views.

Comparison to other BigQuery techniques

The following table summarizes the similarities and differences between BigQuery caching, scheduled queries, logical views, and materialized views.

Component Caching Scheduled queries Logical views Materialized views Optimize compute Yes No No Yes Query support All All All Limited1 Partitioning and clustering No Yes N/A Yes Incremental refresh No No No Yes Additional storage No Yes No Yes Query rewrite No No No Yes Maintenance costs No Yes N/A Yes Data staleness Never Yes Never Optional 2

1 The --allow_non_incremental_definition option supports an expanded range of SQL queries to create materialized views.

2 The --max_staleness option provides consistently high performance with controlled costs when processing large, frequently changing datasets.

You can create an authorized materialized view to share a subset of data from a source dataset to a view in a secondary dataset. You can then share this view to specific users and groups (principals) who can view the data you share. Principals can query the data you provide in a view, but they can't access the source dataset directly.

Authorized views and authorized materialized views are authorized in the same way. For details, see Authorized views.

Interaction with other BigQuery features

The following BigQuery features work transparently with materialized views:

BigLake metadata cache-enabled tables

Materialized views over BigLake metadata cache-enabled tables can reference structured data stored in Cloud Storage and Amazon Simple Storage Service (Amazon S3). These materialized views function like materialized views over BigQuery-managed storage tables, including the benefits of automatic refresh and smart tuning. Other benefits include the pre-aggregating, pre-filtering, and pre-joining of data stored outside of BigQuery. Materialized views over BigLake tables are stored in and have all of the characteristics of BigQuery managed storage.

Note: When a materialized view over a BigLake table with cached metadata is refreshed, the materialized view's cached data contains all updates to the external table up to the most recent metadata cache creation.

When you create a materialized view over an Amazon S3 BigLake table, the data in the materialized view isn't available for joins with BigQuery data. To make Amazon S3 data in a materialized view available for joins, create a replica of the materialized view. You can only create materialized view replicas over authorized materialized views.

Materialized view replicas

BigQuery lets you create materialized views on BigLake metadata cache-enabled tables over Amazon Simple Storage Service (Amazon S3), Apache Iceberg, or Salesforce Data Cloud data.

A materialized view replica lets you use the Amazon S3, Iceberg, or Data Cloud materialized view data in queries while avoiding data egress costs and improving query performance. A materialized view replica does this by replicating the Amazon S3, Iceberg, or Data Cloud data to a dataset in a supported BigQuery region, so that the data is available locally in BigQuery.

Learn how to create materialized view replicas.

Data freshness

After you create the materialized view replica, the replication process polls the source materialized view for changes and replicates data to the materialized view replica. The data is replicated at the interval you specified in the replication_interval_seconds option of the CREATE MATERIALIZED VIEW AS REPLICA OF statement.

In addition to the replication interval, the freshness of the materialized view replica data is also affected by how often the source materialized view refreshes, and how often the metadata cache of the Amazon S3, Iceberg, or Data Cloud table used by the materialized view refreshes.

You can check the data freshness for the materialized view replica and the resources it is based on by using the Google Cloud console:

Supported regions

Use the location mappings in the following table when creating materialized view replicas:

Location of the source materialized view Location of the materialized view replica aws-us-east-1 The US multi-region, or any of the following regions: aws-us-west-2 The US multi-region, or any of the following regions: aws-eu-west-1 The EU multi-region, or any of the following regions: aws-ap-northeast-2 Any of the following regions: aws-ap-southeast-2 Any of the following regions: Limitations

1Logical view reference support is in preview. For more information, see Reference logical views.

Limitations of materialized views over BigLake tables Limitations of materialized view replicas Materialized views pricing

Costs are associated with the following aspects of materialized views:

Component On-demand pricing Capacity-based pricing Querying Bytes processed by materialized views and any necessary portions of the base tables.1 Slots are consumed during query time. Maintenance Bytes processed during refresh time. Slots are consumed during refresh time. Storage Bytes stored in materialized views. Bytes stored in materialized views.

1Where possible, BigQuery reads only the changes since the last time the view was refreshed. For more information, see Incremental updates.

Storage cost details

For AVG, ARRAY_AGG, and APPROX_COUNT_DISTINCT aggregate values in a materialized view, the final value is not directly stored. Instead, BigQuery internally stores a materialized view as an intermediate sketch, which is used to produce the final value.

As an example, consider a materialized view that's created with the following command:

CREATE MATERIALIZED VIEW project-id.my_dataset.my_mv_table AS
SELECT date, AVG(net_paid) AS avg_paid
FROM project-id.my_dataset.my_base_table
GROUP BY date

While the avg_paid column is rendered as NUMERIC or FLOAT64 to the user, internally it is stored as BYTES, with its content being an intermediate sketch in proprietary format. For data size calculation, the column is treated as BYTES.

Materialized view replica costs

Use of materialized view replicas incurs compute, outbound data transfer, and storage costs.

What's next

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

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["Materialized views in BigQuery are precomputed views that cache query results, enhancing performance and efficiency by using cached data and reading only changes from base tables when possible."],["These views offer zero maintenance, automatically refreshing as base tables change, and they ensure data freshness by directly reading from base tables if changes might invalidate the view."],["Materialized views optimize queries with high computation costs and are particularly beneficial for use cases like pre-aggregating, pre-filtering, and pre-joining data, including data from BigLake tables."],["Materialized view replicas allow the use of data from external sources like Amazon S3 within BigQuery, avoiding egress costs and improving performance by replicating the data locally."],["There are costs associated with the use of materialized views, including querying, maintenance during refresh operations, and the storage of the materialized view tables."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4