Get started with reservations
Learn how to create and assign a reservation in BigQuery.
BigQuery reservations let you purchase dedicated processing capacity, measured in slots, instead of paying on-demand pricing per each byte of data processed. With reservations, costs are more predictable and workload performance is often more consistent. Reservations are associated with editions that provide scaled pricing and meet the requirements of different organizations.
When working with reservations, you can create assignments, which link specific Google Cloud projects, folders, or your entire organization to a particular reservation. This lets you isolate workloads, ensure resources for critical tasks, and manage your BigQuery spending more effectively.
In this tutorial, you create a Standard edition reservation with 100 autoscaling slots and assign a project to the reservation. You can then choose to delete the reservation to avoid incurring costs.
To follow step-by-step guidance for this task directly in the Google Cloud console, click Guide me:
Before you begin
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
You can create a separate Google Cloud project to administer the reservation and give it a descriptive name likeRoles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
bq-COMPANY_NAME-admin. -
Verify that billing is enabled for your Google Cloud project.
-
Enable the BigQuery Reservation API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.For more information, see Enable the BigQuery Reservation API.
In the Google Cloud console, view your slot quotas:
To purchase slots, you must have enough slot quota for the region in which you want to purchase slots.
If your slot quota for the region is less than the number of slots you want to purchase, see Request a quota increase.
Required roles
To get the permissions that
you need to create a reservation, assign a project to a reservation, and delete the reservation,
ask your administrator to grant you the
BigQuery Resource Editor (roles/bigquery.resourceEditor)
IAM role on the project.
For more information about granting roles, see Manage access to projects, folders, and organizations.
You might also be able to get the required permissions through custom roles or other predefined roles.
Create an autoscaling reservation
Create a reservation named test in the US multi-region, and allocate a
maximum of 100 autoscaling slots to it. Autoscaling slots scale up or down based
on your workload demands.
In the Google Cloud console, go to the BigQuery page.
In the navigation menu, click Capacity management.
Click Create reservation.
In the Reservation name field, enter
test.In the Location drop-down list, select us (multiple regions in United States).
In the Edition list, select Standard. For more information, see Understand BigQuery editions.
For Max reservation size selector, select Small (100 Slots).
Leave the other default setting as they are, and click Save.
To learn how to create a reservation using SQL or the bq tool, see Create a reservation with dedicated slots.
Assign a project to a reservation
Assign a project to the test reservation. Any query jobs that run from this
project will use the pool of slots from the test reservation. (In this
tutorial, you don't run a job.)
You can assign any project that's in the same organization and region as the administration project where you created the reservation.
In the Google Cloud console, go to the BigQuery page.
In the navigation menu, click Capacity management.
Click the Slot reservations tab.
In the Actions column for the reservation named
test, click Actions.
Click Create assignment.
In the Select an organization, folder or project section, click Browse.
Browse or search for the project, and then select it.
Click Create.
When you create a reservation assignment, wait at least 5 minutes before running a query. Otherwise the query might be billed using on-demand pricing.
To learn how to assign a project to a reservation using SQL or the bq tool, see Assign a project or folder to a reservation.
Clean up
To avoid incurring charges to your Google Cloud account for the resources used on this page, follow these steps.
Delete the project
The easiest way to eliminate billing is to delete the project that you created for the tutorial.
To delete the project:
- In the Google Cloud console, go to the Manage resources page.
- In the project list, select the project that you want to delete, and then click Delete.
- In the dialog, type the project ID, and then click Shut down to delete the project.
Delete the reservation
When you delete a reservation, any jobs that are currently executing with slots from that reservation will fail. To prevent errors, allow in-flight jobs to complete before deleting the reservation.
In the Google Cloud console, go to the BigQuery page.
In the navigation menu, click Capacity management.
Click the Slot reservations tab.
For the reservation named
test, click Toggle node.For each assignment in that reservation, click Actions, and then click Delete.
In the Actions column for the reservation named
test, click Actions.Click Delete.
To learn how to delete a reservation using SQL or the bq tool, see Delete a reservation.
What's next
To learn how to use BigQuery reservations to manage your workloads, see Understand reservations.
To learn more about slots, see Understand slots.
To learn how to use BigQuery assignments to organize your workloads, see Manage workload assignments.
To learn how to purchase a commitment, see Slot commitments.