Introduction to labels
To help organize your BigQuery resources, you can add labels toyour datasets, tables, reservations, and views. Labels are key-value pairs that you can attachto a resource. When you create BigQuery resources, labels areoptional.
After labeling your resources, you can search for them based on label values.For example, you can use labels to group datasets by purpose, environment,department, and so on.
What are labels?
A label is a key-value pair that you can assign to Google Cloud BigQuery resources.They help you organize these resources and manage your costs at scale, with thegranularity you need. You can attach a label to each resource, then filter theresources based on their labels. Information about labels is forwarded to the billing system thatlets you break down your billed charges by label. With built-inbilling reports,you can filter and group costs by resource labels. You can also use labels toquerybilling data exports.
Requirements for labels
The labels applied to a resource must meet the followingrequirements:
- Each resource can have up to 64 labels.
- Each label must be a key-value pair.
- Keys have a minimum length of 1 character and a maximum length of 63characters, and cannot be empty. Values can be empty, and have a maximum lengthof 63 characters.
- Keys and values can contain only lowercase letters, numeric characters,underscores, and dashes. All characters must use UTF-8 encoding, andinternational characters are allowed. Keys must start with a lowercase letter orinternational character.
- The key portion of a label must be unique within a single resource.However, you can use the same key with multiple resources.
These limits apply to the key and value for each label, and to theindividual Google Cloud resources that have labels. Thereis no limit on how many labels you can apply across all resourceswithin a project.
Common uses of labels
Here are some common use cases for labels:
Team or cost center labels: Add labels based on team orcost center to distinguish BigQuery resources owned by differentteams (for example,
team:researchandteam:analytics). You can use thistype of label for cost accounting or budgeting.Component labels: For example,
component:redis,component:frontend,component:ingest, andcomponent:dashboard.Environment or stage labels: For example,
environment:productionandenvironment:test.State labels: For example,
state:active,state:readytodelete, andstate:archive.Ownership labels: Used to identify the teams that areresponsible for operations, for example:
team:shopping-cart.
We don't recommend creating large numbers of unique labels, such asfor timestamps or individual values for every API call.The problem with this approach is that when the values change frequently or withkeys that clutter the catalog, this makes it difficult to effectively filter andreport on resources.
Labels and tags
Labels can be used as queryable annotations for resources, but can't be usedto set conditions on policies. Tags provide a way to conditionally allow ordeny policies based on whether a resource has a specific tag, by providing fine-grainedcontrol over policies. For more information, see theTags overview.
What's next
- Learn how toadd labels to BigQueryresources.
- Learn how toview labels on BigQueryresources.
- Learn how toupdate labels onBigQuery resources.
- Learn how tofilter resources using labels.
- Learn how todelete labels onBigQuery resources.
- Read aboutUsing labels in theResource Manager documentation.
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.