Introduction to INFORMATION_SCHEMA
BigQuery INFORMATION_SCHEMA views let you retrieve metadata about
your BigQuery objects. You can query these read-only,
system-defined views to analyze resources like datasets, jobs, and access
control.
In BigQuery, you query INFORMATION_SCHEMA views using
GoogleSQL by specifying a scope and a view. For example, to get
metadata for tables in a dataset, you specify
myDataset.INFORMATION_SCHEMA.TABLES.
The following table lists the available views:
† For *BY_PROJECT views, the BY_PROJECT suffix is optional. For
example, querying INFORMATION_SCHEMA.JOBS_BY_PROJECT and INFORMATION_SCHEMA.JOBS
return the same results.
Pricing
For projects that use on-demand pricing, queries against INFORMATION_SCHEMA
views incur a minimum of 10 MB of data processing charges, even if the bytes
processed by the query are less than 10 MB. 10 MB is the minimum
billing amount for on-demand queries. For more information, see
On-demand pricing.
For projects that use capacity-based pricing, queries against INFORMATION_SCHEMA
views and tables consume your purchased BigQuery slots. For more
information, see capacity-based pricing.
Because INFORMATION_SCHEMA queries are not cached, you are charged each time
that you run an INFORMATION_SCHEMA query, even if the query text is the same
each time you run it.
You are not charged storage fees for the INFORMATION_SCHEMA views.
Syntax
An INFORMATION_SCHEMA view needs to be qualified with a dataset or region.
Dataset qualifier
When present, a dataset qualifier restricts results to the specified dataset. For example:
-- Returns metadata for tables in a single dataset.
SELECT * FROM myDataset.INFORMATION_SCHEMA.TABLES;
The following INFORMATION_SCHEMA views support dataset qualifiers:
COLUMNSCOLUMN_FIELD_PATHSMATERIALIZED_VIEWSPARAMETERSPARTITIONSROUTINESROUTINE_OPTIONSTABLESTABLE_OPTIONSVIEWS
Region qualifier
Region qualifiers are represented using a
region-REGION syntax.
Any dataset location name can be used for
REGION. For example, the following region qualifiers
are valid:
region-usregion-asia-east2region-europe-north1
When present, a region qualifier restricts results to the specified location.
Region qualifiers aren't
hierarchical, which means the EU multi-region does not include europe-*
regions nor does the US multi-region include the us-* regions. For example,
the following query returns metadata for all datasets in the US multi-region
for the project in which the query is executing, but doesn't include datasets in
the us-west1 region:
-- Returns metadata for all datasets in the US multi-region. SELECT * FROM region-us.INFORMATION_SCHEMA.SCHEMATA;
The following INFORMATION_SCHEMA views don't support region qualifiers:
INFORMATION_SCHEMA.PARTITIONSINFORMATION_SCHEMA.SEARCH_INDEXESINFORMATION_SCHEMA.SEARCH_INDEX_COLUMNSINFORMATION_SCHEMA.SEARCH_INDEX_OPTIONS
If neither a region qualifier nor a dataset qualifier is specified, you will receive an error.
Queries against a region-qualified INFORMATION_SCHEMA view run in the region that you specify, which means that you can't write a single query to join data from views in different regions. To combine INFORMATION_SCHEMA views from multiple regions, read and combine the query results locally, or copy the resulting tables to a common region.
Project qualifier
When present, a project qualifier restricts results to the specified project. For example:
-- Returns metadata for the specified project and region.
SELECT * FROM myProject.`region-us`.INFORMATION_SCHEMA.TABLES;
-- Returns metadata for the specified project and dataset.
SELECT * FROM myProject.myDataset.INFORMATION_SCHEMA.TABLES;
All INFORMATION_SCHEMA views support project qualifiers. If a project
qualifier is not specified, the view will default to the
project in which the query is executing.
Specifying a project qualifier for organization-level views
(for example, STREAMING_TIMELINE_BY_ORGANIZATION)
has no impact on the results.
Limitations
- BigQuery
INFORMATION_SCHEMAqueries must be in GoogleSQL syntax.INFORMATION_SCHEMAdoes not support legacy SQL. INFORMATION_SCHEMAquery results are not cached.INFORMATION_SCHEMAviews cannot be used in DDL statements.INFORMATION_SCHEMAviews don't contain information about hidden datasets.INFORMATION_SCHEMAqueries with region qualifiers might include metadata from resources in that region from deleted datasets that are within your time travel window.- When you list resources from an
INFORMATION_SCHEMAview, the permissions are checked only at the parent level, not at an individual row level. Therefore, any deny policy (preview) that conditionally targets an individual row using tags is ignored.
What's next
- Get table information.
- View Iceberg-managed table metadata.
- View graph schemas.
- Monitor jobs.
- Troubleshoot with information schema.