[[["易于理解","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-17。"],[],[],null,["# SEARCH_INDEX_COLUMN_OPTIONS view\n================================\n\n|\n| **Preview**\n|\n|\n| This product or feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA products and features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nThe `INFORMATION_SCHEMA.SEARCH_INDEX_COLUMN_OPTIONS` view contains one row for\neach option set on a search-indexed column in the tables in a dataset.\n\nRequired permissions\n--------------------\n\nTo see [search index](/bigquery/docs/search-index) metadata, you need the\n`bigquery.tables.get` or `bigquery.tables.list` Identity and Access Management (IAM)\npermission on the table with the index. Each of the following predefined\nIAM roles includes at least one of these permissions:\n\n- `roles/bigquery.admin`\n- `roles/bigquery.dataEditor`\n- `roles/bigquery.dataOwner`\n- `roles/bigquery.dataViewer`\n- `roles/bigquery.metadataViewer`\n- `roles/bigquery.user`\n\nFor more information about BigQuery permissions, see\n[Access control with IAM](/bigquery/docs/access-control).\n\nSchema\n------\n\nWhen you query the `INFORMATION_SCHEMA.SEARCH_INDEX_COLUMN_OPTIONS` view, the query results contain one row for each option set on a search-indexed column in the tables in a dataset.\n\n\u003cbr /\u003e\n\nThe `INFORMATION_SCHEMA.SEARCH_INDEX_OPTIONS` view has the following schema:\n\nScope and syntax\n----------------\n\nQueries against this view must have a [dataset qualifier](/bigquery/docs/information-schema-intro#syntax). The\nfollowing 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\"\u003eDATASET_ID\u003c/var\u003e: the ID of your dataset. For more information, see [Dataset qualifier](/bigquery/docs/information-schema-intro#dataset_qualifier).\n\n\u003cbr /\u003e\n\n**Example** \n\n -- Returns metadata for search index column options in a single dataset.\n SELECT * FROM myDataset.INFORMATION_SCHEMA.SEARCH_INDEX_COLUMN_OPTIONS;\n\nExample\n-------\n\nThe following example sets the default index column granularity to `COLUMN`, and\nindividually sets the granularity for `col2` and `col3` to `GLOBAL` and `COLUMN`\nrespectively. In this example, columns `col2` and `col3` appear in the results\nbecause their granularity is set explicitly. The granularity for column\n`col1` is not shown because it uses the default granularity. \n\n```sql\nCREATE SEARCH INDEX index1 ON `mydataset.table1` (\n ALL COLUMNS WITH COLUMN OPTIONS (\n col2 OPTIONS(index_granularity = 'GLOBAL'),\n col3 OPTIONS(index_granularity = 'COLUMN')\n )\n)\nOPTIONS(\n default_index_column_granularity = 'COLUMN'\n);\n\nSELECT\n index_column_name, option_name, option_type, option_value\nFROM\n mydataset.INFORMATION_SCHEMA.SEARCH_INDEX_COLUMN_OPTIONS\nWHERE\n index_schema = 'mydataset' AND index_name = 'index1' AND table_name = 'table1';\n```\n\nThe result is similar to the following: \n\n```\n+-------------------+-------------------+---------------+--------------+\n| index_column_name | option_name | option_type | option_value |\n+-------------------+-------------------+---------------+--------------+\n| col2 | index_granularity | STRING | GLOBAL |\n| col3 | index_granularity | STRING | COLUMN |\n+-------------------+-------------------+---------------+--------------+\n```\n\nThe following equivalent example, which doesn't use `ALL COLUMNS`, sets the\ndefault index column granularity to\n`COLUMN` and individually sets the granularity for two columns to `GLOBAL` and\n`COLUMN` respectively: \n\n```sql\nCREATE SEARCH INDEX index1 ON `mydataset.table1` (\n col1,\n col2 OPTIONS(index_granularity = 'GLOBAL'),\n col3 OPTIONS(index_granularity = 'COLUMN')\n)\nOPTIONS(\n default_index_column_granularity = 'COLUMN'\n);\n\nSELECT\n index_column_name, option_name, option_type, option_value\nFROM\n mydataset.INFORMATION_SCHEMA.SEARCH_INDEX_COLUMN_OPTIONS\nWHERE\n index_schema = 'mydataset' AND index_name = 'index1' AND table_name = 'table1';\n```\n\nThe result is similar to the following: \n\n```\n+-------------------+-------------------+---------------+--------------+\n| index_column_name | option_name | option_type | option_value |\n+-------------------+-------------------+---------------+--------------+\n| col2 | index_granularity | STRING | GLOBAL |\n| col3 | index_granularity | STRING | COLUMN |\n+-------------------+-------------------+---------------+--------------+\n```"]]