Calculate how much an indexed table's data has drifted between when a
vector index was trained and the present.
VECTOR_INDEX.STATISTICS
VECTOR_INDEX.STATISTICS(TABLEtable_name)
Description
The VECTOR_INDEX.STATISTICS function calculates how much an indexed table's
data has drifted between when a vector index was trained and the
present. Use this function to determine if table data has changed enough to
require a vector index rebuild. If necessary, you can use the
ALTER VECTOR INDEX REBUILD statement to rebuild the vector index.
To alter vector indexes, you must have the BigQuery Data Editor
(roles/bigquery.dataEditor) or BigQuery Data Owner
(roles/bigquery.dataOwner) IAM role on the table that contains the
vector index.
Definitions
table_name: The name of the table that contains the vector index,
in the format dataset_name.table_name.
If there is no active vector index on the table, the function returns empty
results. If there is an active vector index on the table, but the index
training isn't complete, the function returns a NULL drift score.
Output
A FLOAT64 value in the range [0,1). A lower value indicates less drift.
Typically, a change of 0.3 or greater is considered significant.
Example
This example returns the drift for the table mytable.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[],[],null,["# Vector index functions\n\n| **Preview**\n|\n|\n| This product or feature is subject to the \"Pre-GA Offerings Terms\"\n| in the General Service Terms section of the\n| [Service Specific Terms](/terms/service-terms).\n| Pre-GA products and features are available \"as is\" and might have\n| limited support. For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n| **Note:** To provide feedback or request support for this feature, send email to [bq-vector-search@google.com](mailto:bq-vector-search@google.com).\n\nGoogleSQL for BigQuery supports the following vector index functions.\n\nFunction list\n-------------\n\n`VECTOR_INDEX.STATISTICS`\n-------------------------\n\n| **Preview**\n|\n|\n| This product or feature is subject to the \"Pre-GA Offerings Terms\"\n| in the General Service Terms section of the\n| [Service Specific Terms](/terms/service-terms).\n| Pre-GA products and features are available \"as is\" and might have\n| limited support. For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n**Note:** To provide feedback or request support for this feature, send email to [bq-vector-search@google.com](mailto:bq-vector-search@google.com). \n\n VECTOR_INDEX.STATISTICS(\n TABLE table_name\n )\n\n**Description**\n\nThe `VECTOR_INDEX.STATISTICS` function calculates how much an indexed table's\ndata has drifted between when a [vector index](/bigquery/docs/vector-index) was trained and the\npresent. Use this function to determine if table data has changed enough to\nrequire a vector index rebuild. If necessary, you can use the\n[`ALTER VECTOR INDEX REBUILD` statement](/bigquery/docs/reference/standard-sql/data-definition-language#alter_vector_index_rebuild_statement) to rebuild the vector index.\n\nTo alter vector indexes, you must have the BigQuery Data Editor\n(`roles/bigquery.dataEditor`) or BigQuery Data Owner\n(`roles/bigquery.dataOwner`) IAM role on the table that contains the\nvector index.\n\n**Definitions**\n\n- `table_name`: The name of the table that contains the vector index,\n in the format `dataset_name.table_name`.\n\n If there is no active vector index on the table, the function returns empty\n results. If there is an active vector index on the table, but the index\n training isn't complete, the function returns a `NULL` drift score.\n\n**Output**\n\nA `FLOAT64` value in the range `[0,1)`. A lower value indicates less drift.\nTypically, a change of `0.3` or greater is considered significant.\n\n**Example**\n\nThis example returns the drift for the table `mytable`. \n\n SELECT * FROM VECTOR_INDEX.STATISTICS(TABLE mydataset.mytable);"]]