JOBS_BY_ORGANIZATION view
The INFORMATION_SCHEMA.JOBS_BY_ORGANIZATION
view contains near real-time
metadata about all jobs submitted in the organization that is associated with
the current project.
Required role
To get the permission that
you need to query the INFORMATION_SCHEMA.JOBS_BY_ORGANIZATION
view,
ask your administrator to grant you the BigQuery Resource Viewer
( roles/bigquery.resourceViewer
)
IAM role on your organization.
For more information about granting roles, see Manage access to projects, folders, and organizations
.
This predefined role contains the bigquery.jobs.listAll
permission,
which is required to
query the INFORMATION_SCHEMA.JOBS_BY_ORGANIZATION
view.
You might also be able to get this permission with custom roles or other predefined roles .
The schema table is only available to users with defined Google Cloud organizations.
For more information about BigQuery permissions, see Access control with IAM .
Schema
The underlying data is partitioned by the creation_time
column and
clustered by project_id
and user_email
. The query_info
column contains
additional information about your query jobs.
The INFORMATION_SCHEMA.JOBS_BY_ORGANIZATION
view has the following schema:
bi_engine_statistics
RECORD
NULL
.cache_hit
BOOLEAN
cache_hit
for your parent query is NULL
.creation_time
TIMESTAMP
end_time
TIMESTAMP
DONE
state.folder_numbers
REPEATED INTEGER
folder_numbers
is [1, 2, 3]
, then folder 1
immediately contains the project, folder 2
contains 1
, and folder 3
contains 2
. This column is only
populated in JOBS_BY_FOLDER
.job_creation_reason.code
STRING
Possible values are:
-
REQUESTED
: job creation was requested. -
LONG_RUNNING
: the query request ran beyond a system defined timeout specified by the timeoutMs field in theQueryRequest
. As a result it was considered a long running operation for which a job was created. -
LARGE_RESULTS
: the results from the query cannot fit in the in-line response. -
OTHER
: the system has determined that the query needs to be executed as a job.
job_id
STRING
bquxjob_1234
.job_stages
RECORD
Note : This column's values are empty for queries that read from tables with row-level access policies. For more information, see best practices for row-level security in BigQuery.
job_type
STRING
QUERY
, LOAD
, EXTRACT
, COPY
, or NULL
. A NULL
value indicates a background
job.labels
RECORD
parent_job_id
STRING
priority
STRING
INTERACTIVE
and BATCH
.project_id
STRING
project_number
INTEGER
query
STRING
JOBS_BY_PROJECT
view has the query
column.referenced_tables
RECORD
reservation_id
STRING
RESERVATION_ADMIN_PROJECT:RESERVATION_LOCATION.RESERVATION_NAME
.In this output:
-
RESERVATION_ADMIN_PROJECT
: the name of the Google Cloud project that administers the reservation -
RESERVATION_LOCATION
: the location of the reservation -
RESERVATION_NAME
: the name of the reservation
edition
STRING
start_time
TIMESTAMP
PENDING
state to either RUNNING
or DONE
.state
STRING
PENDING
, RUNNING
, and DONE
.statement_type
STRING
DELETE
, INSERT
, SCRIPT
, SELECT
, or UPDATE
. See QueryStatementType
for list of valid values.total_bytes_billed
INTEGER
Note : This column's values are empty for queries that read from tables with row-level access policies. For more information, see best practices for row-level security in BigQuery.
total_bytes_processed
INTEGER
Total bytes processed by the job.
Note : This column's values are empty for queries that read from tables with row-level access policies. For more information, see best practices for row-level security in BigQuery.
total_modified_partitions
INTEGER
LOAD
and QUERY
jobs.total_slot_ms
INTEGER
RUNNING
state,
including retries.user_email
STRING
query_info.resource_warning
STRING
A successful query job can have the
resource_warning
field populated. With resource_warning
, you get additional data points to optimize your queries and to set up monitoring for performance trends of an equivalent set of queries by using query_hashes
.query_info.query_hashes.normalized_literals
STRING
normalized_literals
is a hexadecimal STRING
hash that ignores comments, parameter values, UDFs, and literals.
The hash value will differ when underlying views change, or if the query implicitly
references columns, such as SELECT *
, and the table schema changes.This field appears for successful GoogleSQL queries that are not cache hits.
transferred_bytes
INTEGER
materialized_view_statistics
RECORD
metadata_cache_statistics
RECORD
query_dialect
STRING
-
GOOGLE_SQL
: Job was requested to use GoogleSQL. -
LEGACY_SQL
: Job was requested to use LegacySQL. -
DEFAULT_LEGACY_SQL
: No query dialect was specified in the job request. BigQuery used the default value of LegacySQL. -
DEFAULT_GOOGLE_SQL
: No query dialect was specified in the job request. BigQuery used the default value of GoogleSQL.
This field is only populated for query jobs. The default selection of query dialect can be controlled by the configuration settings .
continuous_query_info.output_watermark
TIMESTAMP
Data retention
This view contains running jobs and the job history of the past 180 days.
Scope and syntax
Queries against this view must include a region qualifier . The following table explains the region scope for this view:
View name | Resource scope | Region scope |
---|---|---|
[ PROJECT_ID
.]`region- REGION
`.INFORMATION_SCHEMA.JOBS_BY_ORGANIZATION
|
Organization that contains the specified project | REGION
|
- Optional:
PROJECT_ID
: the ID of your Google Cloud project. If not specified, the default project is used. -
REGION
: any dataset region name . For example,`region-us`
.
Example
To run the query against a project other than your default project, add the project ID in the following format:
` PROJECT_ID `.`region- REGION_NAME `.INFORMATION_SCHEMA.JOBS_BY_ORGANIZATION
-
PROJECT_ID
: the ID of the project -
REGION_NAME
: the region for your project
For example, `myproject`.`region-us`.INFORMATION_SCHEMA.JOBS_BY_ORGANIZATION
.