# BigQuery INFORMATION_SCHEMA: Syntax and Examples | Masthead

INFORMATION_SCHEMA is BigQuery's set of read-only metadata views for tables, columns, partitions, storage and jobs. Query mydataset.INFORMATION_SCHEMA.TABLES or region-us.INFORMATION_SCHEMA.TABLE_STORAGE to audit schemas, find large tables and estimate storage cost. Each on-demand query bills at least 10 MB.

> For the index of this section of the site, see [llms.txt](https://mastheadata.com/llms.txt)

BigQuery · Metadata view

# BigQuery INFORMATION\_SCHEMA

INFORMATION\_SCHEMA is BigQuery's set of read-only metadata views for tables, columns, partitions, storage and jobs. Query mydataset.INFORMATION\_SCHEMA.TABLES or region-us.INFORMATION\_SCHEMA.TABLE\_STORAGE to audit schemas, find large tables and estimate storage cost. Each on-demand query bills at least 10 MB.

GoogleSQL for BigQuery · Checked against the [official reference](https://docs.cloud.google.com/bigquery/docs/information-schema-intro) in November 2026

`INFORMATION_SCHEMA` views are system views you query with ordinary SQL. Every reference needs a qualifier. A dataset qualifier (`mydataset.INFORMATION_SCHEMA.TABLES`) limits results to one dataset and works for `TABLES`, `COLUMNS`, `COLUMN_FIELD_PATHS`, `PARTITIONS`, `VIEWS`, `MATERIALIZED_VIEWS`, `TABLE_OPTIONS`, `ROUTINES`, `ROUTINE_OPTIONS`, `PARAMETERS` and `ROW_ACCESS_POLICIES`. A region qualifier (`region-us.INFORMATION_SCHEMA.TABLES`) covers every dataset of the project in that location and is required for project-wide views such as `JOBS` and `TABLE_STORAGE`. A project prefix in front of either reads another project. With no qualifier at all, the query fails.

The views you will use most: `TABLES` (one row per table, view or snapshot, including a `ddl` column with the statement that recreates it), `COLUMNS` (types, nullability, `is_partitioning_column` and `clustering_ordinal_position`), `PARTITIONS` (rows, bytes, `last_modified_time` and `storage_tier` per partition), `TABLE_STORAGE` (logical, physical, time-travel and fail-safe bytes per table) and [INFORMATION\SCHEMA.JOBS](https://mastheadata.com/bigquery/sql/information-schema-jobs.md) (job history with bytes billed and slot time).

Region qualifiers are not hierarchical: `region-us` is the US multi-region and does not include `us-central1`, and `region-eu` does not include `europe-west3`. The query must run in the same location as the view, and one query cannot join views from two regions. View names are case-sensitive, so write `INFORMATION_SCHEMA` in capitals.

Metadata is not always instant. Schema changes can take a moment to appear in `TABLES` and `COLUMNS` (`bq show` reads the table directly), `TABLE_STORAGE` lags by seconds to minutes, and changes caused by table or partition expiration can take up to a day to show there. `PARTITIONS` is in Preview, accepts only a dataset qualifier and reads at most 1,000 tables per query.

## Syntax

```
SELECT ... FROM [project_id.]dataset_id.INFORMATION_SCHEMA.view_name

SELECT ... FROM [project_id.]`region-REGION`.INFORMATION_SCHEMA.view_name
```

## Arguments and return value

| Argument | Description |
| --- | --- |
| `project_id` | Optional. The project to read. Defaults to the project that runs the query. With a project prefix, put a dashed project ID and the region in backticks. |
| `dataset_id` | Dataset qualifier: limits the view to one dataset. Supported by dataset-level views such as `TABLES`, `COLUMNS`, `PARTITIONS` and `VIEWS`. |
| `REGION` | Region qualifier written as `region-us`, `region-eu` or `region-europe-west3`. Required for `JOBS`, `TABLE_STORAGE` and other project-level views. Not supported by `PARTITIONS`. |
| `view_name` | The view, in capitals: `TABLES`, `COLUMNS`, `PARTITIONS`, `TABLE_STORAGE`, `JOBS`, `SCHEMATA`, `VIEWS`, `ROUTINES` and others. |

**Returns:** A result set of metadata rows, one per object the view describes (table, column, partition, job), limited to the objects you have permission to list.

## Examples

### List the tables in a dataset with the DDL to recreate them

`table_type` is `BASE TABLE`, `VIEW`, `MATERIALIZED VIEW`, `EXTERNAL`, `SNAPSHOT` or `CLONE`. The `ddl` column is a quick way to copy a table definition into version control.

```
SELECT table_name, table_type, creation_time, ddl
FROM project.dataset.INFORMATION_SCHEMA.TABLES
ORDER BY creation_time DESC;
```

### Find partitioning and clustering columns across a region

Every dataset of the project in the US multi-region. Tables with no row here are neither partitioned nor clustered, which makes them the first suspects when a query scans too much.

```
SELECT
  table_schema,
  table_name,
  column_name,
  data_type,
  is_partitioning_column,
  clustering_ordinal_position
FROM `region-us`.INFORMATION_SCHEMA.COLUMNS
WHERE is_partitioning_column = 'YES'
   OR clustering_ordinal_position IS NOT NULL
ORDER BY table_schema, table_name, clustering_ordinal_position;
```

### Largest tables and their monthly storage cost under each billing model

US list prices per GiB-month: logical $0.02 active and $0.01 long-term, physical $0.04 active and $0.02 long-term. `active_physical_bytes` already includes time-travel bytes, so only fail-safe bytes are added. The estimate ignores the free first 10 GiB and is a snapshot of today's bytes, not the prorated bill.

```
SELECT
  table_schema,
  table_name,
  ROUND(total_logical_bytes / POW(1024, 3), 1) AS logical_gib,
  ROUND(total_physical_bytes / POW(1024, 3), 1) AS physical_gib,
  ROUND(active_logical_bytes / POW(1024, 3) * 0.02
    + long_term_logical_bytes / POW(1024, 3) * 0.01, 2) AS logical_billing_usd,
  ROUND((active_physical_bytes + fail_safe_physical_bytes) / POW(1024, 3) * 0.04
    + long_term_physical_bytes / POW(1024, 3) * 0.02, 2) AS physical_billing_usd
FROM `region-us`.INFORMATION_SCHEMA.TABLE_STORAGE
ORDER BY total_logical_bytes DESC
LIMIT 20;
```

### Partition sizes and storage tier for one table

`storage_tier` is `LONG_TERM` for partitions not modified for 90 days. `partition_id` is `__NULL__` for rows with a NULL partitioning value and `__UNPARTITIONED__` for rows outside the partition range.

```
SELECT
  partition_id,
  total_rows,
  ROUND(total_logical_bytes / POW(1024, 3), 2) AS logical_gib,
  last_modified_time,
  storage_tier
FROM project.dataset.INFORMATION_SCHEMA.PARTITIONS
WHERE table_name = 'events'
ORDER BY partition_id DESC
LIMIT 30;
```

## Common mistakes

*   Leaving out the qualifier. `SELECT * FROM INFORMATION_SCHEMA.TABLES` fails with [Table "INFORMATION\SCHEMA.TABLES" must be qualified with a dataset](https://mastheadata.com/bigquery/errors/table-name-missing-dataset.md). Add a dataset (`analytics.INFORMATION_SCHEMA.TABLES`) or a region (`region-us.INFORMATION_SCHEMA.TABLES`).
*   Expecting `region-us` to cover all US locations. It is the US multi-region only. Datasets in `us-central1` or `us-east4` need `region-us-central1` or `region-us-east4`, in separate queries; a mismatch fails with a [Not found](https://mastheadata.com/bigquery/errors/table-not-found.md) error naming the location.
*   Writing view names in lowercase. `region-us.information_schema.tables` is read as an ordinary dataset and table and fails with [Access Denied](https://mastheadata.com/bigquery/errors/access-denied-permission-to-query-table.md). Use `INFORMATION_SCHEMA` and the view name in capitals.
*   Querying `PARTITIONS` for a whole region. It only accepts a dataset qualifier and stops at 1,000 tables with "INFORMATION\_SCHEMA.PARTITIONS query attempted to read too many tables". Filter on `table_name`, or query dataset by dataset.
*   Adding `time_travel_physical_bytes` to `active_physical_bytes`. Active physical bytes already include time travel, so the sum double counts. Fail-safe bytes are separate and are the only ones to add for physical billing.

## Cost and performance

*   On-demand, every `INFORMATION_SCHEMA` query bills at least 10 MB and is never served from cache, so the same metadata query run every five minutes is billed every five minutes. On capacity pricing these queries consume your reservation's slots. The views carry no storage charge.
*   Loading, streaming or running DML that modifies a partition restarts its 90-day timer and returns it to active storage, which costs twice the long-term rate. Querying, exporting or copying the table does not. Check `storage_tier` in `PARTITIONS` before a backfill rewrites years of `LONG_TERM` partitions.
*   `TABLE_STORAGE` reports bytes at this moment. Storage is billed in GiB-months, prorated over time, so a table created yesterday costs a fraction of what the snapshot suggests for this month. Use it to rank tables and pick a billing model, then confirm in Cloud Billing.

## FAQ

How do I list all tables in a BigQuery dataset?

`SELECT table_name, table_type FROM mydataset.INFORMATION_SCHEMA.TABLES`. For every dataset in a location, use the region qualifier instead: `region-us.INFORMATION_SCHEMA.TABLES`, which adds the `table_schema` (dataset) column you can group by.

How do I get the size of a BigQuery table?

Read `total_logical_bytes`, `total_physical_bytes` and `total_rows` from `region-us.INFORMATION_SCHEMA.TABLE_STORAGE`, or per partition from `dataset.INFORMATION_SCHEMA.PARTITIONS`. Both are metadata queries and do not scan the table.

Does querying INFORMATION\_SCHEMA cost money?

Yes on on-demand pricing: at least 10 MB per query, with no caching. On capacity pricing it uses slots from your reservation. See [BigQuery pricing](https://mastheadata.com/bigquery/pricing.md).

How do I find which column a table is partitioned or clustered by?

In `INFORMATION_SCHEMA.COLUMNS`, `is_partitioning_column = 'YES'` marks the partitioning column and `clustering_ordinal_position` gives the order of clustering columns (1 is the first). The `ddl` column of `TABLES` shows both in the `PARTITION BY` and `CLUSTER BY` clauses.

## Related

[INFORMATION\SCHEMA.JOBS](https://mastheadata.com/bigquery/sql/information-schema-jobs.md)[PARTITION BY (partitioned tables)](https://mastheadata.com/bigquery/sql/partition-by.md)[CLUSTER BY](https://mastheadata.com/bigquery/sql/cluster-by.md)[CREATE TABLE](https://mastheadata.com/bigquery/sql/create-table.md)[ALTER TABLE](https://mastheadata.com/bigquery/sql/alter-table.md)[CREATE VIEW](https://mastheadata.com/bigquery/sql/create-view.md)[CREATE MATERIALIZED VIEW](https://mastheadata.com/bigquery/sql/create-materialized-view.md)

### Errors you may hit

[Table must be qualified with a dataset](https://mastheadata.com/bigquery/errors/table-name-missing-dataset.md)[Table was not found in location](https://mastheadata.com/bigquery/errors/table-not-found.md)[User does not have permission to query table, or perhaps it does not exist](https://mastheadata.com/bigquery/errors/access-denied-permission-to-query-table.md)

[All BigQuery INFORMATION\SCHEMA](https://mastheadata.com/bigquery/information-schema-views.md) · [All statements and clauses](https://mastheadata.com/bigquery/sql.md) · [BigQuery error messages](https://mastheadata.com/bigquery/errors.md)
---

## Other pages in sql

> For the full index of this section, see [BigQuery Reference](https://mastheadata.com/llms/llms-bigquery-reference.txt).

- [BigQuery ALTER TABLE: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/alter-table.md): ALTER TABLE changes a BigQuery table without rewriting it: ADD COLUMN, DROP COLUMN, RENAME TO, RENAME COLUMN, SET OPTIONS (expiration, description, labels, partition filter) and ALTER COLUMN SET DATA TYPE for widening changes such as INT64 to NUMERIC. These are metadata changes and process no bytes.
- [BigQuery CLUSTER BY: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/cluster-by.md): CLUSTER BY sorts a BigQuery table's storage blocks by up to four columns, so queries that filter on those columns skip blocks and bill fewer bytes. Use it on large tables filtered by columns such as customer_id or status, usually on top of date partitioning.
- [BigQuery CREATE FUNCTION: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/create-function.md): CREATE FUNCTION defines a user-defined function (UDF) in SQL or JavaScript. CREATE TEMP FUNCTION lives for one query or script; CREATE FUNCTION dataset.name is persistent and shared. Prefer SQL UDFs: they are inlined, while JavaScript UDFs use more slots and lack 64-bit integers.
- [BigQuery CREATE MATERIALIZED VIEW: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/create-materialized-view.md): CREATE MATERIALIZED VIEW stores the result of an aggregation over a BigQuery table and keeps it current automatically. Queries read the small precomputed result plus recent changes instead of rescanning the base table, cutting cost for dashboards that repeat the same GROUP BY.
- [BigQuery CREATE TABLE: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/create-table.md): CREATE TABLE creates a BigQuery table from a column list, from a query (CREATE TABLE AS SELECT), or both, with optional partitioning, clustering and OPTIONS such as expiration and description. Add OR REPLACE to overwrite a table or IF NOT EXISTS to skip one that exists.
- [BigQuery CREATE TEMP TABLE: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/create-temp-table.md): CREATE TEMP TABLE stores intermediate results in a table that exists only for the current multi-statement query or session, without a dataset. Use it to compute an expensive step once and reuse it, instead of a CTE that BigQuery re-runs at every reference.
- [BigQuery CREATE VIEW: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/create-view.md): CREATE VIEW saves a query under a table-like name. A BigQuery view stores no data and re-runs its query on every use, billed for the underlying tables' bytes. Authorize the view on the source dataset to share a filtered subset without granting access to the tables.
- [BigQuery DECLARE and SET: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/declare-set.md): DECLARE creates a variable in a BigQuery multi-statement query and SET assigns it: DECLARE run_date DATE DEFAULT CURRENT_DATE(); SET run_date = '2026-11-22'. Variables make scripts reusable, and a date variable in a WHERE clause still prunes partitions.
- [BigQuery DELETE: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/delete.md): DELETE removes the rows of a BigQuery table that match a WHERE clause, which is mandatory. A DELETE that covers whole partitions and filters only on the partitioning column can drop them without scanning bytes; any other DELETE bills the bytes read plus the size of the table or partitions it rewrites.
- [BigQuery EXECUTE IMMEDIATE: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/execute-immediate.md): EXECUTE IMMEDIATE runs a SQL statement built as a string at run time, with values bound through USING and results stored with INTO. Use it for dynamic table names, generated PIVOT column lists and maintenance across many tables; bind values as parameters, never by concatenation.
- [BigQuery EXPORT DATA: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/export-data.md): EXPORT DATA writes the result of a query to files in Cloud Storage (CSV, JSON, Avro or Parquet), or to Bigtable, Spanner, Pub/Sub or AlloyDB. The export itself is free; you pay for the query that produces the data, and the URI must contain one  wildcard.
- [BigQuery GROUP BY ROLLUP, CUBE and GROUPING SETS: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/group-by-rollup.md): ROLLUP, CUBE and GROUPING SETS compute several GROUP BY levels in one query: ROLLUP(a, b) adds subtotals per a and a grand total, CUBE(a, b) adds every combination, and GROUPING SETS lists the exact groupings you want. GROUPING() tells subtotal rows from real NULLs.
- [BigQuery INFORMATION_SCHEMA.JOBS: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/information-schema-jobs.md): INFORMATION_SCHEMA.JOBS lists every BigQuery job in a project for the last 180 days, with bytes billed, slot milliseconds, errors and query text. Query it to find the most expensive queries, attribute cost by user or label, and turn total_bytes_billed into an on-demand cost estimate.
- [BigQuery INSERT: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/insert.md): INSERT adds rows to a BigQuery table from a VALUES list or a SELECT query. On-demand it bills only the bytes the SELECT reads. Insert in batches: BigQuery is not built for row-by-row INSERTs, and after 1,500 INSERT statements on a table in a day, extra ones are queued.
- [BigQuery JOIN: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/join.md): JOIN combines rows of two tables on a condition: INNER JOIN keeps matches, LEFT, RIGHT and FULL OUTER JOIN also keep unmatched rows with NULLs, and CROSS JOIN pairs every row with every row. In BigQuery a comma or CROSS JOIN with UNNEST flattens an array column.
- [BigQuery LOAD DATA: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/load-data.md): LOAD DATA loads files from Cloud Storage (CSV, JSON, Avro, Parquet, ORC) into a BigQuery table from SQL: LOAD DATA INTO appends, LOAD DATA OVERWRITE replaces, and a missing table is created. If the load fails, the table is left unchanged.
- [BigQuery LOOP, WHILE and FOR...IN: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/loops.md): BigQuery scripts loop with LOOP ... END LOOP (exit with BREAK or LEAVE), WHILE condition DO ... END WHILE, REPEAT ... UNTIL ... END REPEAT, and FOR row IN (query) DO ... END FOR. Use them for backfills and maintenance, not row-by-row processing: each statement inside runs as its own job.
- [BigQuery MERGE: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/merge.md): MERGE updates, inserts and deletes rows of a BigQuery table in one atomic statement, by matching it against a source table or query. It is BigQuery's upsert: WHEN MATCHED THEN UPDATE, WHEN NOT MATCHED THEN INSERT, and WHEN NOT MATCHED BY SOURCE THEN DELETE for rows that disappeared.
- [BigQuery PARTITION BY (partitioned tables): Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/partition-by.md): PARTITION BY in CREATE TABLE splits a BigQuery table into partitions by a DATE, TIMESTAMP or DATETIME column, by ingestion time, or by integer ranges. Queries that filter on the partitioning column read and bill only the matching partitions, which makes it the main lever on query cost.
- [BigQuery PIVOT: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/pivot.md): PIVOT turns row values into columns with an aggregate: PIVOT(SUM(revenue) FOR quarter IN ('Q1', 'Q2', 'Q3', 'Q4')) gives one revenue column per quarter. The IN list must be constants, so build it with EXECUTE IMMEDIATE when the values are dynamic.
- [BigQuery QUALIFY: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/qualify.md): QUALIFY filters rows on the result of a window function, the way HAVING filters on aggregates. Use it to keep the latest row per key or the top N per group without a subquery: QUALIFY ROW_NUMBER() OVER (PARTITION BY id ORDER BY updated_at DESC) = 1.
- [BigQuery SELECT * EXCEPT: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/select-except.md): SELECT  EXCEPT (col1, col2) returns every column except the ones you list. In BigQuery it also lowers on-demand cost, because excluded columns are not read: dropping a wide payload or blob column from SELECT  can cut the bytes billed by most of the table.
- [BigQuery SELECT * REPLACE: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/select-replace.md): SELECT  REPLACE (expression AS column) returns every column but swaps the value of the named columns for an expression, keeping their names and positions. Use it to mask, round, cast or clean a few columns without listing all the others.
- [BigQuery TABLESAMPLE SYSTEM: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/tablesample.md): TABLESAMPLE SYSTEM (n PERCENT) reads a random subset of a BigQuery table's storage blocks instead of the whole table, so exploratory queries on large tables scan and bill only about n percent of the bytes. Results are approximate and change on every run.
- [BigQuery TRUNCATE TABLE: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/truncate-table.md): TRUNCATE TABLE removes every row from a BigQuery table but keeps its schema, partitioning, clustering, description and labels. It is a metadata operation, so it costs nothing, unlike DELETE WHERE TRUE, which is billed as DML.
- [BigQuery UNION ALL and UNION DISTINCT: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/union.md): UNION ALL stacks the rows of two queries; UNION DISTINCT does the same and removes duplicates. BigQuery requires the ALL or DISTINCT keyword, matches columns by position unless you add BY NAME, and also offers INTERSECT DISTINCT and EXCEPT DISTINCT.
- [BigQuery UNPIVOT: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/unpivot.md): UNPIVOT turns columns into rows: UNPIVOT(amount FOR month IN (jan, feb, mar)) gives one row per month with its value in amount. Rows whose value is NULL are dropped unless you add INCLUDE NULLS.
- [BigQuery UPDATE: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/update.md): UPDATE changes column values in existing BigQuery rows. The WHERE clause is mandatory (use WHERE TRUE to update every row), and UPDATE ... FROM joins another table. On-demand it bills the bytes read plus the full size of the table, or of the partitions being updated.
- [BigQuery WITH RECURSIVE: Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/with-recursive.md): WITH RECURSIVE defines a CTE that references itself, so a query can walk hierarchies and graphs of unknown depth: org charts, category trees, dependency lineage. BigQuery stops a recursive CTE with an error after 500 iterations.
- [BigQuery WITH (CTE): Syntax and Examples | Masthead](https://mastheadata.com/bigquery/sql/with.md): WITH defines named subqueries (common table expressions) that the rest of a query can reference like tables. In BigQuery a non-recursive CTE is not materialized: each reference runs it again, so a CTE over a large table used three times is scanned and billed three times.
- [BigQuery SQL Syntax: Statements, Clauses, DDL and DML | Masthead](https://mastheadata.com/bigquery/sql.md): BigQuery SQL syntax reference: QUALIFY, PIVOT, MERGE, CTEs, partitioned and clustered tables, scripting and INFORMATION_SCHEMA. 31 statements and clauses with examples and cost notes.
