Introduction to Views

This page provides an overview of views in BigQuery.

Views

A view is a virtual table defined by a SQL query. When you create a view, you query it in the same way you query a table. When a user queries the view, the query results contain data only from the tables and fields specified in the query that defines the view.

You can query views in BigQuery by using the:

You can also use a view as a data source for a visualization tool such as Google Data Studio.

View limitations

BigQuery views are subject to the following limitations:

  • The dataset that contains your view and the dataset that contains the tables referenced by the view must be in the same location.
  • You cannot run a BigQuery job that exports data from a view.
  • You cannot use the TableDataList JSON API method to retrieve data from a view. For more information, see Tabledata: list.
  • You cannot mix standard SQL and legacy SQL queries when using views. A standard SQL query cannot reference a view defined using legacy SQL syntax.
  • The schemas of the underlying tables are stored with the view when the view is created. If columns are added, deleted, and so on after the view is created, the reported schema will be inaccurate until the view is updated. Even though the reported schema may be inaccurate, all submitted queries produce accurate results.
  • You cannot update a legacy SQL view to standard SQL in the BigQuery web UI. You can change the SQL language using the command-line tool bq update --view command or by using the update or patch API methods.
  • You cannot include a user-defined function in the SQL query that defines a view.
  • You cannot reference a view in a wildcard table query.
  • BigQuery supports up to 16 levels of nested views. If there are more than 16 levels, an INVALID_INPUT error returns.
  • You can add up to 1,000 authorized views to a dataset's access control list.

View quotas

SQL queries used to define views are subject to the standard query quotas.

View pricing

BigQuery's views are logical views, not materialized views. Because views are not materialized, the query that defines the view is run each time the view is queried. Queries are billed according to the total amount of data in all table fields referenced directly or indirectly by the top-level query. For more information, see query pricing.

Next steps

Was this page helpful? Let us know how we did:

Send feedback about...