[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-29。"],[[["\u003cp\u003eThe \u003ccode\u003eINFORMATION_SCHEMA.RESERVATIONS\u003c/code\u003e view provides a real-time list of all active reservations within the administration project, with each row representing a unique, current reservation.\u003c/p\u003e\n"],["\u003cp\u003eAccessing the \u003ccode\u003eINFORMATION_SCHEMA.RESERVATIONS\u003c/code\u003e view requires the \u003ccode\u003ebigquery.reservations.list\u003c/code\u003e IAM permission, which is included in several predefined roles like \u003ccode\u003eroles/bigquery.resourceAdmin\u003c/code\u003e and \u003ccode\u003eroles/bigquery.user\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThis view's schema includes details such as the DDL statement used to create the reservation, project ID and number, reservation name, slot capacity, autoscale information, and the edition associated with the reservation.\u003c/p\u003e\n"],["\u003cp\u003eQueries against this view need to incorporate a region qualifier to specify the region from which metadata should be retrieved, with the option to retrieve data from all regions if no qualifier is provided.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eRESERVATIONS\u003c/code\u003e view can be joined with job views, such as \u003ccode\u003eJOBS_TIMELINE\u003c/code\u003e, using the \u003ccode\u003ereservation_id\u003c/code\u003e from job views and the \u003ccode\u003eproject_id\u003c/code\u003e and \u003ccode\u003ereservation_name\u003c/code\u003e from the reservation views to associate job timeslices with their respective reservation information.\u003c/p\u003e\n"]]],[],null,["# RESERVATIONS view\n=================\n\nThe `INFORMATION_SCHEMA.RESERVATIONS` view contains a near real-time list of all\ncurrent reservations within the administration project. Each row represents a\nsingle, current reservation. A current reservation is a reservation that has not\nbeen deleted. For more information about reservation, see\n[Introduction to reservations](/bigquery/docs/reservations-intro).\n\nRequired permission\n-------------------\n\nTo query the `INFORMATION_SCHEMA.RESERVATIONS` view, you need\nthe `bigquery.reservations.list` Identity and Access Management (IAM) permission on the\nproject.\nEach of the following predefined IAM roles includes the required\npermission:\n\n- BigQuery Resource Admin (`roles/bigquery.resourceAdmin`)\n- BigQuery Resource Editor (`roles/bigquery.resourceEditor`)\n- BigQuery Resource Viewer (`roles/bigquery.resourceViewer`)\n- BigQuery User (`roles/bigquery.user`)\n- BigQuery Admin (`roles/bigquery.admin`)\n\nFor more information about BigQuery permissions, see\n[BigQuery IAM roles and permissions](/bigquery/docs/access-control).\n\nSchema\n------\n\nThe `INFORMATION_SCHEMA.RESERVATIONS` view has the\nfollowing schema:\n\nScope and syntax\n----------------\n\nQueries against this view must include a [region qualifier](/bigquery/docs/information-schema-intro#syntax).\nIf you do not specify a regional qualifier, metadata is retrieved from all\nregions. The following table explains the region scope for this view:\n\nReplace the following:\n\n- Optional: \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: the ID of your Google Cloud project. If not specified, the default project is used.\n- \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: any [dataset region name](/bigquery/docs/locations). For example, ```region-us```.\n\n \u003cbr /\u003e\n\n \u003cbr /\u003e\n\n | **Note:** You must use [a region qualifier](/bigquery/docs/information-schema-intro#region_qualifier) to query `INFORMATION_SCHEMA` views. The location of the query execution must match the region of the `INFORMATION_SCHEMA` view.\n\n\u003cbr /\u003e\n\nJoining between the reservation views and the job views\n-------------------------------------------------------\n\nThe [job views](/bigquery/docs/information-schema-jobs-by-user) contain the column\n`reservation_id`. If your job ran in a project with a reservation assigned to\nit, `reservation_id` would follow this format:\n\u003cvar translate=\"no\"\u003ereservation-admin-project\u003c/var\u003e`:`\u003cvar translate=\"no\"\u003ereservation-location\u003c/var\u003e`.`\u003cvar translate=\"no\"\u003ereservation-name\u003c/var\u003e.\n\nTo join between the reservation views and the job views, you can join between\nthe job views column `reservation_id` and the reservation views columns\n`project_id` and `reservation_name`. The following example shows an example of a\nusing the `JOIN` clause between the reservation and the job views.\n\nExample\n-------\n\nThe following example shows slot usage, slot capacity, and assigned reservation\nfor a project with a reservation assignment, over the past hour. Slot usage is\ngiven in units of slot milliseconds per second. \n\n```googlesql\nWITH\n job_data AS (\n SELECT\n job.period_start,\n job.reservation_id,\n job.period_slot_ms,\n job.job_id,\n job.job_type\n FROM\n `\u003cvar translate=\"no\"\u003emy-project\u003c/var\u003e.region-us`.INFORMATION_SCHEMA.JOBS_TIMELINE AS job\n WHERE\n job.period_start \u003e TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 HOUR))\nSELECT\n reservation.reservation_name AS reservation_name,\n job.period_start,\n reservation.slot_capacity,\n job.period_slot_ms,\n job.job_id,\n job.job_type\nFROM\n job_data AS job\nINNER JOIN\n `\u003cvar translate=\"no\"\u003ereservation-admin-project\u003c/var\u003e.region-us`.INFORMATION_SCHEMA.RESERVATIONS AS reservation\nON\n (job.reservation_id = CONCAT(reservation.project_id, \":\", \"US\", \".\", reservation.reservation_name));\n```\n\nThe output is similar to the following: \n\n +------------------+---------------------+---------------+----------------+------------------+----------+\n | reservation_name | period_start | slot_capacity | period_slot_ms | job_id | job_type |\n +------------------+---------------------+---------------+----------------+------------------+----------+\n | my_reservation | 2021-04-30 17:30:54 | 100 | 11131 | bquxjob_66707... | QUERY |\n | my_reservation | 2021-04-30 17:30:55 | 100 | 49978 | bquxjob_66707... | QUERY |\n | my_reservation | 2021-04-30 17:30:56 | 100 | 9038 | bquxjob_66707... | QUERY |\n | my_reservation | 2021-04-30 17:30:57 | 100 | 17237 | bquxjob_66707... | QUERY |\n\nThis query uses the `RESERVATIONS` view to get reservation\ninformation. If the reservations have changed in the past hour, the\n`reservation_slot_capacity` column might not be accurate.\n\nThe query joins `RESERVATIONS` with\n[`JOBS_TIMELINE`](/bigquery/docs/information-schema-jobs-timeline) to\nassociate the job timeslices with the reservation information."]]