Schema:

ACCOUNT_USAGE

SEARCH_OPTIMIZATION_HISTORY view

This Account Usage view can be used to query maintenance history for indexes maintained by the search optimization service. The information returned by the view includes the index, the base table, and the credits consumed by each maintenance operation.

Note

The INDEX_ID, INDEX_NAME, INDEX_TYPE, BASE_TABLE_ID, and BASE_TABLE_NAME columns replace TABLE_ID and TABLE_NAME when SEARCH_OPTIMIZATION_HISTORY views: New columns and column changes (Pending) is enabled. If you have scripts that query TABLE_ID or TABLE_NAME, update them to use the new column names.

Columns

Column NameData TypeDescription
START_TIMETIMESTAMP_LTZStart of the specified time range.
END_TIMETIMESTAMP_LTZEnd of the specified time range.
CREDITS_USEDNUMBERNumber of credits billed for search optimization service index maintenance during the START_TIME and END_TIME window.
INDEX_IDNUMBERInternal/system-generated identifier for the index. Replaces TABLE_ID.
INDEX_NAMEVARCHAR

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_TYPEVARCHAR

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_IDNUMBERInternal/system-generated identifier for the base table.
BASE_TABLE_NAMEVARCHARName of the base table.
SCHEMA_IDNUMBERInternal/system-generated identifier for the schema that contains the base table.
SCHEMA_NAMEVARCHARName of the schema that contains the base table.
DATABASE_IDNUMBERInternal/system-generated identifier for the database that contains the base table.
DATABASE_NAMEVARCHARName of the database that contains the base table.

Usage notes

  • Billing history is not necessarily updated immediately. Latency for the view may be up to 180 minutes (3 hours).
  • Use INDEX_TYPE to distinguish search optimization index maintenance (Search Optimization Index) from search optimization secondary index maintenance (Secondary Index). These values are not hybrid table secondary indexes.

  • INDEX_ID identifies the specific index. INDEX_NAME is a system-generated alias for a search optimization index (SEARCH OPTIMIZATION ON: <base_table_id>), or the customer-defined name for a search optimization secondary index.

  • BASE_TABLE_ID and BASE_TABLE_NAME identify the table that the index is defined on.

  • The output contains one row for each maintenance operation that is executed. Each operation updates information about one index. The number of operations executed on each index depends on the number and size of updates to the data in the base table.

    You can use combinations of aggregate functions and GROUP BY clauses to aggregate costs per index, per base table, or across all tables.

  • If you want to reconcile the data in this view with a corresponding view in the ORGANIZATION USAGE schema, you must first set the timezone of the session to UTC. Before querying the Account Usage view, execute:

    ALTER SESSION SET TIMEZONE = UTC;