Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Introdução às visualizações
Uma visualização é uma tabela virtual definida por uma consulta SQL. É possível usar visualizações para
fornecer um nome facilmente reutilizável para uma consulta complexa ou um conjunto limitado de dados
que pode autorizar
o acesso de outros usuários. Depois de criar uma visualização, o usuário pode consultar a visualização como faria em uma
tabela. Os resultados contêm apenas os dados das tabelas e dos campos especificados
na consulta que define a visualização.
A consulta que define a visualização é executada sempre que ela é consultada. Se você
consulta com frequência uma visualização grande ou computacionalmente cara, considere criar uma visualização materializada.
Normalmente, as visualizações do BigQuery são usadas para:
Abstrair e armazenar o cálculo e a lógica de mesclagem em um objeto comum
para simplificar o uso da consulta
Fornecer acesso a um subconjunto de lógica de dados e cálculo
sem acessar as tabelas base
Também é possível usar uma visualização como fonte de dados de uma ferramenta de visualização, como o
Looker Studio.
Comparação com visualizações materializadas
As visualizações são virtuais e fornecem uma referência reutilizável a um conjunto de dados, mas não armazenam dados fisicamente. As visualizações materializadas são definidas usando SQL, como uma visualização normal, mas armazenam fisicamente os dados
que o BigQuery usa para melhorar o desempenho. Para conferir mais comparações, consulte recursos de visualizações materializadas.
Visualizar limitações
As visualizações do BigQuery estão sujeitas às seguintes limitações:
As visualizações são somente leitura. Por exemplo, não é possível executar consultas que inserem, atualizam
ou excluem dados.
O conjunto de dados que contém a visualização precisa estar no mesmo local que o conjunto de dados que contém as tabelas referenciadas pela visualização.
Uma referência dentro de uma visualização precisa ser qualificada com um conjunto de dados. O conjunto
de dados padrão não afeta o corpo de uma visualização.
Não é possível usar o método de API JSON TableDataList para recuperar dados de uma visualização. Para mais informações, consulte Tabledata: list.
Não é possível mesclar consultas do GoogleSQL e do SQL legado ao usar visualizações.
Uma consulta do GoogleSQL não pode indicar uma visualização definida
usando a sintaxe do SQL legado.
Os esquemas das tabelas subjacentes são armazenados com a visualização quando ela é criada. Se colunas forem adicionadas, excluídas ou modificadas depois que a visualização for
for criado, a visualização não será atualizada automaticamente, e o esquema informado
permanecerão imprecisas até que a definição do SQL da visualização seja alterada ou que a visualização
é recriada. Apesar dessa imprecisão, todas as consultas enviadas terão resultados precisos.
Não é possível atualizar automaticamente uma visualização de SQL legada para a sintaxe
GoogleSQL. Para
modificar a consulta usada para definir uma visualização, use o seguinte:
Não é possível incluir uma função definida pelo usuário temporária ou uma tabela temporária na consulta SQL que define uma visualização.
Não é possível referenciar uma visualização em consultas a uma tabela curinga.
Visualizar cotas
Para informações sobre cotas e limites que se aplicam a visualizações, consulte Limites da visualização.
As consultas SQL usadas para definir visualizações estão sujeitas aos jobs de consulta padrão.
Ver preços
As visualizações do BigQuery são lógicas e não materializadas.
Por isso, a consulta que define as visualizações é executada sempre que elas são consultadas. As consultas são faturadas de acordo com a quantidade total de dados em todos os campos da tabela referenciados direta ou indiretamente pela consulta de nível superior. Para mais informações, acesse Preços de consulta.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-03-18 UTC."],[[["\u003cp\u003eViews in BigQuery are virtual tables defined by SQL queries, providing a reusable name for complex queries or a specific subset of data.\u003c/p\u003e\n"],["\u003cp\u003eUnlike materialized views, regular views do not store data physically; instead, the defining query is executed each time the view is queried.\u003c/p\u003e\n"],["\u003cp\u003eViews are read-only and subject to limitations such as requiring datasets to be in the same location and not being compatible with legacy SQL when using GoogleSQL.\u003c/p\u003e\n"],["\u003cp\u003eViews are used for simplifying query logic, abstracting calculations, and providing access to specific data subsets without exposing underlying tables, and they are also usable as a data source for visualization tools like Looker Studio.\u003c/p\u003e\n"],["\u003cp\u003eQuerying views incurs costs based on the total data size of the underlying tables' fields referenced in the view's defining query, and security is managed via authorized views.\u003c/p\u003e\n"]]],[],null,["# Introduction to logical views\n=============================\n\nThis document provides an overview of BigQuery support for logical\nviews.\n\nOverview\n--------\n\nA view is a virtual table defined by a SQL query. The default type of view for\nBigQuery is a *logical view*.\nQuery results contain only the data from the tables and fields\nspecified in the query that defines the view.\n\nThe query that defines a view is run each time the view is queried.\n\n**Types of views**\n\nAlthough logical views are the default type of view, if you frequently query a large or\ncomputationally expensive view, then you should consider creating a\n[*materialized view*](/bigquery/docs/materialized-views-intro), which is a\nprecomputed view that periodically caches the results of a query for increased performance and\nefficiency.\n\nHowever, you can often improve performance of a logical view without the need to create a\nmaterialized view by querying only a subset of your data, or by\n[using other techniques.](/bigquery/docs/materialized-views-intro#comparison)\n\nYou can also create an [*authorized view*](/bigquery/docs/authorized-views) to\nshare a subset of data from a source dataset to a view in a secondary dataset. You can then share\nthis view to specific users and groups (principals) who can view the data you share and run\nqueries on it, but who can't access the source dataset directly.\n\nYou can create an authorized view for either a logical or materialized view. An authorized view\nfor a materialized view is called an *authorized materialized view*.\n\n**Use cases**\n\nCommon use cases for views include the following:\n\n\n- Provide an easily reusable name for a complex query or a limited set of data that you can then [authorize](/bigquery/docs/authorized-views) other users to access. After you create a view, a user can then [query](/bigquery/docs/running-queries) the view as they would a table.\n- Abstract and store calculation and join logic in a common object to simplify query use.\n- Provide access to a subset of data and calculation logic without providing access to the base tables.\n- Optimize queries with high computation cost and small dataset results for [several use cases](/bigquery/docs/materialized-views-intro#use_cases).\n\n\u003cbr /\u003e\n\nYou can also use views in other contexts:\n\n- As a data source for a visualization tool such as [Looker Studio](/looker/docs).\n- As a means of sharing data to subscribers of [BigQuery sharing (formerly Analytics Hub)](/bigquery/docs/analytics-hub-introduction).\n\nComparison to materialized views\n--------------------------------\n\nLogical views are virtual and provide a reusable reference to a set of data, but\ndon't physically store any data. Materialized views are defined using SQL,\nlike a logical view, but physically store the data which BigQuery\nuses to improve performance. For further comparison, see\n[materialized views features](/bigquery/docs/materialized-views-intro#comparison).\n\nLogical views limitations\n-------------------------\n\nBigQuery views are subject to the following limitations:\n\n- Views are read-only. For example, you can't run queries that insert, update, or delete data.\n- The dataset that contains your view and the dataset that contains the tables referenced by the view must be in the same [location](/bigquery/docs/locations).\n- A reference inside of a view must be qualified with a dataset. The default dataset doesn't affect a view body.\n- You cannot use the `TableDataList` JSON API method to retrieve data from a view. For more information, see [Tabledata: list](/bigquery/docs/reference/rest/v2/tabledata/list).\n- You cannot mix GoogleSQL and legacy SQL queries when using views. A GoogleSQL query cannot reference a view defined using legacy SQL syntax.\n- You cannot reference [query parameters](/bigquery/docs/parameterized-queries) in views.\n- The schemas of the underlying tables are stored with the view when the view is created. If columns are added, deleted, or modified after the view is created, the view isn't automatically updated and the reported schema will remain inaccurate until the view SQL definition is changed or the view is recreated. Even though the reported schema may be inaccurate, all submitted queries produce accurate results.\n- You cannot automatically update a legacy SQL view to GoogleSQL syntax. To modify the query used to define a view, you can use the following:\n - The [**Edit query**](/bigquery/docs/updating-views#update-sql) option in the Google Cloud console\n - The [`bq update --view`](/bigquery/docs/reference/bq-cli-reference#bq_update) command in the bq command-line tool\n - The [BigQuery Client libraries](/bigquery/docs/reference/libraries)\n - The [update](/bigquery/docs/reference/rest/v2/tables/update) or [patch](/bigquery/docs/reference/rest/v2/tables/patch) API methods.\n- You cannot include a temporary user-defined function or a temporary table in the SQL query that defines a view.\n- You cannot reference a view in a [wildcard table](/bigquery/docs/querying-wildcard-tables) query.\n\nLogical views quotas\n--------------------\n\nFor information on quotas and limits that apply to views, see\n[View limits](/bigquery/quotas#view_limits).\n\nSQL queries used to define views are also subject to the quotas on\n[query jobs](/bigquery/quotas#query_jobs).\n\nLogical views pricing\n---------------------\n\nBigQuery uses logical views by default, not\n[materialized views](/bigquery/docs/materialized-views-intro).\nBecause views are not materialized by default, the query that defines the view\nis run each time the view is queried. Queries are billed according to the total\namount of data in all table fields referenced directly or indirectly by the top-level\nquery.\n\n- For general query pricing, see [On-demand compute pricing](/bigquery/pricing#on_demand_pricing).\n- For pricing associated with materialized views, see [Materialized views pricing](/bigquery/docs/materialized-views-intro#materialized_views_pricing).\n\nLogical views security\n----------------------\n\nTo control access to views in BigQuery, see\n[Authorized views](/bigquery/docs/authorized-views).\n\nWhat's next\n-----------\n\n- For information on creating views, see [Creating views](/bigquery/docs/views).\n- For information on creating an authorized view, see [Creating authorized views](/bigquery/docs/authorized-views).\n- For information on getting view metadata, see [Getting information about views](/bigquery/docs/view-metadata).\n- For more information on managing views, see [Managing views](/bigquery/docs/managing-views)."]]