SEARCH_OPTIMIZATION_HISTORY

functionsupportedTables, views, streams, sequencesEnterprise+

docs.snowflake.com ↗

Information SchemaTable functions

This table function is used for querying maintenance history for indexes maintained by the search optimization service for a specified table within a specified date range. The information returned by the function includes the index, the base table, and the credits consumed each time a maintenance operation occurred. Note This function is generally deprecated in favor of the ACCOUNT_USAGE.SEARCH_OPTIMIZATION_HISTORY view, which provides a more complete data set and supports longer date ranges. The INDEX_ID, INDEX_NAME, INDEX_TYPE, BASE_TABLE_ID, and BASE_TABLE_NAME columns replace TABLE_NAME when SEARCH_OPTIMIZATION_HISTORY views: New columns and column changes (Generally enabled) is enabled. If you have scripts that query TABLE_NAME, update them to use the new column names.

Syntax

supportedpartialnot supportednot scored

SEARCH_OPTIMIZATION_HISTORY(
      [ DATE_RANGE_START => <constant_expr> ]
      [ , DATE_RANGE_END => <constant_expr> ]
      [ , TABLE_NAME => '<string>' ] )

Parameters

NameRequiredDescription
DATE_RANGE_START => constant_expr , DATE_RANGE_END => constant_exprrequiredThe date/time range for which to display the history. For example, if you specify that the start date is 2019-04-03 and the end date is 2019-04-05, then you get data for April 3, April 4, and April 5. (The endpoints are included.) If neither a start date nor an end date is specified, the default is the last 12 hours. If an end date is not specified, but a start date is specified, then CURRENT_DATE at midnight is used as the end of the range. If a start date is not specified, but an end date is specified, then the range starts 12 hours prior to the start of DATE_RANGE_END.
TABLE_NAME => stringrequiredThe table name. If specified, only shows the history for the specified table. The name can include the schema name and the database name. If a name is not specified, then the results include the data for each table that has a search optimization service index for which maintenance occurred within the specified time range.

Usage notes

Output

The function returns the following columns: Column Name | Data Type | Description START_TIME | TIMESTAMP_LTZ | Start of the specified time range. END_TIME | TIMESTAMP_LTZ | End of the specified time range. CREDITS_USED | TEXT | Number of credits billed for search optimization service index maintenance during the START_TIME and END_TIME window. INDEX_ID | NUMBER | Internal/system-generated identifier for the index. Replaces TABLE_ID. INDEX_NAME | TEXT | Name of the index. Replaces TABLE_NAME. For a search optimization index, this is a system-generated alias of the form SEARCH OPTIMIZATION ON: <base_table_id>. For a search optimization secondary index, this is the customer-defined index name. INDEX_TYPE | TEXT | Type of index maintained by the search optimization service. Possible values are Search Optimization Index and Secondary Index. Secondary Index is not a hybrid table secondary index. BASE_TABLE_ID | NUMBER | Internal/system-generated identifier for the base table. BASE_TABLE_NAME | TEXT | Name of the base table.