Schema:

ACCOUNT_USAGE

SEARCH_OPTIMIZATION_HISTORY view

This Account Usage view can be used to query the search history. The information returned by the view includes the search optimization service name and credits consumed by the service.

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 the search optimization service during the START_TIME and END_TIME window.
TABLE_IDNUMBERInternal/system-generated identifier for the search optimization service.
TABLE_NAMEVARCHARThis is a system-generated alias that contains the ID of the table for which search optimization was enabled; that ID is embedded inside a string of the form “SEARCH OPTIMIZATION ON TABLE_ID: <optimized_table_id>”. For example, if you enable search optimization on a table named accounts, and if accounts has ID 1200, then the TABLE_NAME (alias) shown in this column will be “SEARCH OPTIMIZATION ON TABLE_ID: 1200”.
SCHEMA_IDNUMBERInternal/system-generated identifier for the schema that contains the search optimization service.
SCHEMA_NAMEVARCHARName of the schema that contains the search optimization service.
DATABASE_IDNUMBERInternal/system-generated identifier for the database that contains the search optimization service.
DATABASE_NAMEVARCHARName of the database that contains the search optimization service.

Usage notes

  • Billing history is not necessarily updated immediately. Latency for the view may be up to 180 minutes (3 hours).
  • Remember that the TABLE_ID column and the TABLE_NAME column do not refer to the same database object.

    • The TABLE_ID identifies the search optimization service instance.
    • The TABLE_NAME shows the table ID of the base table, which is the table

      on which the search optimization service is enabled

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

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

  • The view shows only base table IDs, not base table names, so the view does not directly show costs associated with base tables by name.

  • 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;