System procedures reference

BigQuery supports the following system procedures, which can beused similarly to user-createdstored procedures.

BQ.ABORT_SESSION

Syntax

CALLBQ.ABORT_SESSION([session_id]);

Description

Terminates your current session.

You can optionally specify thesession ID,which lets you terminate a session if the system procedure isn't called fromthat session.

For more information, seeTerminating sessions.

BQ.JOBS.CANCEL

Syntax

CALLBQ.JOBS.CANCEL(job);

Description

Cancels a running job.

Specify the job as a string with the format'[project_id.]job_id'. If you runthis system procedure from a different project than the job, then you mustinclude the project ID. You must run the procedure in the same location as thejob.

For more information, seeCanceling a job.

BQ.REFRESH_EXTERNAL_METADATA_CACHE

Syntax

CALLBQ.REFRESH_EXTERNAL_METADATA_CACHE(table_name[,[subdirectory_uri,]]);

Description

Refreshes the metadata cache of a BigLake table or an object table.This procedure fails if you run it against a table that has the metadatacaching mode set toAUTOMATIC.

To run this system procedure, you need thebigquery.tables.update andbigquery.tables.updateData permissions.

Specify the name of the table as a string with the format'[project_id.]dataset.table'. If you run this system procedure from adifferent project than the table, then you must include the project ID.

For BigLake tables, you can optionally specify one or moresubdirectories of the table data directory inCloud Storage in the format'gs://table_data_directory/subdirectory/.../'.This lets you refresh only the table metadata from those subdirectories andthereby avoid unnecessary metadata processing.

Examples

To refresh all of the metadata for a table:

CALLBQ.REFRESH_EXTERNAL_METADATA_CACHE('myproject.test_db.test_table')

To selectively refresh the metadata for a BigLake table:

CALLBQ.REFRESH_EXTERNAL_METADATA_CACHE('myproject.test_db.test_table',['gs://source/uri/sub/path/d1/*','gs://source/uri/sub/path/d2/*'])

Limitation

  • Metadata cache refresh is not supported for tables referenced by linkeddatasets over external datasets.
  • Metadata cache refresh shouldn't be used in aMulti-statement transaction.

BQ.REFRESH_MATERIALIZED_VIEW

Syntax

CALLBQ.REFRESH_MATERIALIZED_VIEW(view_name);

Description

Refreshes a materialized view.

Specify the name of the materialized view as a string with the format'[project_id.]dataset.table'. If you run this system procedure from adifferent project than the materialized view, then you must include the projectID.

For more information, seeManual refresh.

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

Last updated 2025-12-15 UTC.