IAM で保護されているリソースを使用したアクセスは追加型です。たとえば、エンティティにプロジェクトなどの上位レベルのアクセス権がない場合は、データセット レベルでアクセス権を付与すると、データセット内のテーブルとビューにアクセスできます。同様に、エンティティに高レベルまたはデータセット レベルでのアクセス権がない場合は、テーブルレベルまたはビューレベルでエンティティにアクセス権を付与できます。
プロジェクト レべル、フォルダレベル、組織レベルなど、Google Cloudリソース階層の上位レベルで IAM ロールを付与すると、エンティティは幅広いリソースのセットにアクセスできるようになります。たとえば、プロジェクト レベルでエンティティにロールを付与すると、そのエンティティには、プロジェクトに含まれるすべてのデータセットに適用される権限が付与されます。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-04 UTC。"],[],[],null,["# Manage clustered tables\n=======================\n\nThis document describes how to get information about and control access to\nclustered tables in BigQuery.\n\nFor more information, see the following:\n\n- To learn about clustered table support in BigQuery, see [Introduction to clustered tables](/bigquery/docs/clustered-tables).\n- To learn how to create clustered tables, see [Create clustered tables](/bigquery/docs/creating-clustered-tables).\n\nBefore you begin\n----------------\n\nTo get information about tables, you must have the\n`bigquery.tables.get` permission. The following predefined IAM\nroles include `bigquery.tables.get` permissions:\n\n- `roles/bigquery.metadataViewer`\n- `roles/bigquery.dataViewer`\n- `roles/bigquery.dataOwner`\n- `roles/bigquery.dataEditor`\n- `roles/bigquery.admin`\n\nIn addition, if a user has the `bigquery.datasets.create` permission, when that\nuser creates a dataset, they are granted `bigquery.dataOwner` access to it.\n`bigquery.dataOwner` access gives the user the ability to get information about\ntables in a dataset.\n\nFor more information about IAM roles and permissions in\nBigQuery, see\n[Predefined roles and permissions](/bigquery/docs/access-control).\n\nControl access to clustered tables\n----------------------------------\n\nTo configure access to tables and views, you can grant an\nIAM role to an entity at the following levels, listed in\norder of range of resources allowed (largest to smallest):\n\n- a high level in the [Google Cloud resource hierarchy](/resource-manager/docs/cloud-platform-resource-hierarchy) such as the project, folder, or organization level\n- the dataset level\n- the table or view level\n\nYou can also restrict data access within tables, by using the following\nmethods:\n\n- [column-level security](/bigquery/docs/column-level-security-intro)\n- [column data masking](/bigquery/docs/column-data-masking-intro)\n- [row-level security](/bigquery/docs/row-level-security-intro)\n\nAccess with any resource protected by IAM is additive. For\nexample, if an entity does not have access at the high level such as a project,\nyou could grant the entity access at the dataset level, and then the entity will\nhave access to the tables and views in the dataset. Similarly, if the entity\ndoes not have access at the high level or the dataset level, you could grant the\nentity access at the table or view level.\n\nGranting IAM roles at a higher level in the [Google Cloud\nresource hierarchy](/resource-manager/docs/cloud-platform-resource-hierarchy)\nsuch as the project, folder, or organization level gives the entity access to a\nbroad set of resources. For example, granting a role to an entity at the project\nlevel gives that entity permissions that apply to all datasets throughout the\nproject.\n\nGranting a role at the dataset level specifies the operations an entity is\nallowed to perform on tables and views in that specific dataset, even if the\nentity does not have access at a higher level. For information on configuring\ndataset-level access controls, see\n[Controlling access to datasets](/bigquery/docs/dataset-access-controls).\n\nGranting a role at the table or view level specifies the operations an entity is\nallowed to perform on specific tables and views, even if the entity does not\nhave access at a higher level. For information on configuring table-level access\ncontrols, see\n[Controlling access to tables and views](/bigquery/docs/table-access-controls).\n\nYou can also create [IAM custom roles](/iam/docs/creating-custom-roles).\nIf you create a custom role, the permissions you grant depend on the specific\noperations you want the entity to be able to perform.\n\nYou can't set a \"deny\" permission on any resource protected by\nIAM.\n\nFor more information about roles and permissions, see [Understanding roles](/iam/docs/understanding-roles)\nin the IAM documentation and the BigQuery\n[IAM roles and permissions](/bigquery/docs/access-control).\n\nGet information about clustered tables\n--------------------------------------\n\nSelect one of the following options: \n\n### Console\n\n1. In the Google Cloud console, go to the **Resources** pane.\n\n2. Click your dataset name to expand it, and then click the table name\n that you want to view.\n\n3. Click **Details**.\n\n The table's details are displayed, including the clustering columns.\n\n### SQL\n\nFor clustered tables, you can query the `CLUSTERING_ORDINAL_POSITION` column\nin the [`INFORMATION_SCHEMA.COLUMNS` view](/bigquery/docs/information-schema-columns)\nto find the 1-indexed offset of the column within the table's clustering\ncolumns:\n\n\u003cbr /\u003e\n\n1. In the Google Cloud console, go to the **BigQuery** page.\n\n [Go to BigQuery](https://console.cloud.google.com/bigquery)\n2. In the query editor, enter the following statement:\n\n ```googlesql\n CREATE TABLE mydataset.data (column1 INT64, column2 INT64)\n CLUSTER BY column1, column2;\n SELECT\n column_name, clustering_ordinal_position\n FROM\n mydataset.INFORMATION_SCHEMA.COLUMNS;\n ```\n\n \u003cbr /\u003e\n\n3. Click play_circle **Run**.\n\n \u003cbr /\u003e\n\nFor more information about how to run queries, see [Run an interactive query](/bigquery/docs/running-queries#queries).\n\nThe clustering ordinal position is 1 for `column1` and 2 for `column2`.\nMore table metadata is available through the `TABLES`, `TABLE_OPTIONS`,\n`COLUMNS`, and `COLUMN_FIELD_PATH` views in [`INFORMATION_SCHEMA`](/bigquery/docs/information-schema-intro).\n\n### bq\n\nIssue the `bq show` command to display all table information. Use the\n`--schema` flag to display only table schema information. The `--format`\nflag can be used to control the output.\n\nIf you are getting information about a table in a project other than\nyour default project, add the project ID to the dataset in the following\nformat: \u003cvar translate=\"no\"\u003eproject_id:dataset\u003c/var\u003e. \n\n```bash\nbq show \\\n --schema \\\n --format=prettyjson \\\n PROJECT_ID:DATASET.TABLE\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: your project ID\n- \u003cvar translate=\"no\"\u003eDATASET\u003c/var\u003e: the name of the dataset\n- \u003cvar translate=\"no\"\u003eTABLE\u003c/var\u003e: the name of the table\n\nExamples:\n\nEnter the following command to display all information about\n`myclusteredtable` in `mydataset`. `mydataset` in your default project. \n\n bq show --format=prettyjson mydataset.myclusteredtable\n\nThe output should look like the following: \n\n```\n{\n \"clustering\": {\n \"fields\": [\n \"customer_id\"\n ]\n },\n...\n}\n```\n\n\u003cbr /\u003e\n\n### API\n\nCall the [`bigquery.tables.get`](/bigquery/docs/reference/rest/v2/tables/get)\nmethod and provide any relevant parameters.\n\nList clustered tables in a dataset\n----------------------------------\n\nThe permissions required to list clustered tables and the steps to list them\nare the same as for standard tables. For more information, see\n[Listing tables in a dataset](/bigquery/docs/tables#list_tables_in_a_dataset).\n\nModify the clustering specification\n-----------------------------------\n\nYou can change or remove a table's clustering specifications, or change the set\nof clustered columns in a clustered table. This method of updating the\nclustering column set is useful for tables that use continuous streaming inserts\nbecause those tables cannot be easily swapped by other methods.\n\nFollow these steps to apply a new clustering specification to unpartitioned or\npartitioned tables.\n\n1. In the bq tool, update the clustering specification of your\n table to match the new clustering:\n\n ```\n bq update --clustering_fields=CLUSTER_COLUMN DATASET.ORIGINAL_TABLE \n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eCLUSTER_COLUMN\u003c/var\u003e: the column you are clustering on---for example, `mycolumn`\n - \u003cvar translate=\"no\"\u003eDATASET\u003c/var\u003e: the name of the dataset containing the table---for example, `mydataset`\n - \u003cvar translate=\"no\"\u003eORIGINAL_TABLE\u003c/var\u003e: the name of your original table---for example, `mytable`\n\n You can also call the `tables.update` or `tables.patch` API method to [modify the clustering specification](/bigquery/docs/creating-clustered-tables#modifying-cluster-spec).\n2. To cluster all rows according to the new clustering specification,\n run the following `UPDATE` statement:\n\n ```googlesql\n UPDATE DATASET.ORIGINAL_TABLE SET CLUSTER_COLUMN=CLUSTER_COLUMN WHERE true\n ```\n | **Note:** If a new clustering specification is applied to a table that is in long-term storage, then the table reverts to active storage pricing. For more information, see [Storage pricing](https://cloud.google.com/bigquery/pricing#storage).\n\nWhat's next\n-----------\n\n- For information about querying clustered tables, see [Query clustered tables](/bigquery/docs/querying-clustered-tables).\n- For an overview of partitioned table support in BigQuery, see [Introduction to partitioned tables](/bigquery/docs/partitioned-tables).\n- To learn how to create partitioned tables, see [Create partitioned tables](/bigquery/docs/creating-partitioned-tables)."]]