> For the complete documentation index, see [llms.txt](https://docs.espresso.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.espresso.ai/snowflake-optimizer/snowflake-metadata.md).

# Snowflake Metadata

This page describes what Snowflake metadata Espresso reads and why. In general, we look at workload metadata to be able to understand and optimize your traffic patterns.

Espresso will *never* access your Snowflake data.

We read metadata from Snowflake's [`ACCOUNT_USAGE`](https://docs.snowflake.com/en/sql-reference/account-usage) and, when available, [`ORGANIZATION_USAGE`](https://docs.snowflake.com/en/sql-reference/organization-usage) schemas. The regular product and the savings estimate use different sets of metadata. Some views depend on your Snowflake edition or enabled features; when a view is unavailable, we skip it.

Most customers, including public companies, are comfortable sharing this data under NDA.

## Savings estimate

For a savings estimate, we pull only the metadata below.

| Snowflake view                                                                                                                                                                                                                                                                                                                    | Why we use it                                                                                                               |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- |
| [`QUERY_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/query_history)                                                                                                                                                                                                                                        | To understand what workloads you're running and when, along with statistics such as runtime, queue time, and bytes scanned. |
| [`QUERY_ATTRIBUTION_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/query_attribution_history) and [`QUERY_METERING_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/query_metering_history)                                                                                               | To understand compute cost at the query level.                                                                              |
| [`WAREHOUSE_EVENTS_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/warehouse_events_history)                                                                                                                                                                                                                  | To see warehouse events, such as warehouses turning on and off and clusters spinning up and down.                           |
| [`WAREHOUSE_METERING_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/warehouse_metering_history)                                                                                                                                                                                                              | To measure hourly credit usage by warehouse.                                                                                |
| [`METERING_DAILY_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/metering_daily_history)                                                                                                                                                                                                                      | To measure daily credit usage across the account.                                                                           |
| [`RATE_SHEET_DAILY`](https://docs.snowflake.com/en/sql-reference/organization-usage/rate_sheet_daily), [`CONTRACT_ITEMS`](https://docs.snowflake.com/en/sql-reference/organization-usage/contract_items), and [`REMAINING_BALANCE_DAILY`](https://docs.snowflake.com/en/sql-reference/organization-usage/remaining_balance_daily) | To calculate financial projections and understand committed spend.                                                          |

We also run [`SHOW WAREHOUSES`](https://docs.snowflake.com/en/sql-reference/sql/show-warehouses) to read warehouse settings such as size and type. We use Snowflake's [`CURRENT_REGION`](https://docs.snowflake.com/en/sql-reference/functions/current_region), [`CURRENT_ACCOUNT`](https://docs.snowflake.com/en/sql-reference/functions/current_account), [`CURRENT_ORGANIZATION_NAME`](https://docs.snowflake.com/en/sql-reference/functions/current_organization_name), and [`CURRENT_ACCOUNT_NAME`](https://docs.snowflake.com/en/sql-reference/functions/current_account_name) functions to uniquely identify the account.

[`QUERY_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/query_history) contains user-generated query text. If your query text is sensitive, we're happy to sign an NDA or a BAA before sharing data. We can remove query text from a savings estimate export upon request. All other fields in these views are machine-generated.

We can also omit [`RATE_SHEET_DAILY`](https://docs.snowflake.com/en/sql-reference/organization-usage/rate_sheet_daily) and [`CONTRACT_ITEMS`](https://docs.snowflake.com/en/sql-reference/organization-usage/contract_items) from a savings estimate upon request.

## Regular product

The regular product pulls the savings estimate metadata above, plus the views below. This broader set lets us report on all Snowflake spend, understand account configuration, and identify cost outliers and edge cases. Many of these views are feature-specific and optional; unavailable views are skipped.

| Category                             | Additional Snowflake views                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Workload and warehouse activity      | [`ACCESS_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/access_history), [`SESSIONS`](https://docs.snowflake.com/en/sql-reference/account-usage/sessions), [`WAREHOUSE_CLUSTER_UTILIZATION`](https://docs.snowflake.com/en/sql-reference/account-usage), and [`WAREHOUSE_LOAD_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/warehouse_load_history) (for accounts where warehouse-load collection is enabled)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| Billing, services, and data movement | [`APPLICATION_DAILY_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/application_daily_usage_history), [`AUTOMATIC_CLUSTERING_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/automatic_clustering_history), [`CATALOG_LINKED_DATABASE_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/catalog_linked_database_usage_history), [`COPY_FILES_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/copy_files_history), [`DATA_QUALITY_MONITORING_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/data_quality_monitoring_usage_history), [`DATA_TRANSFER_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/data_transfer_history), [`DATABASE_REPLICATION_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/database_replication_usage_history), [`HYBRID_TABLE_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/hybrid_table_usage_history), [`ICEBERG_STORAGE_OPTIMIZATION_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/iceberg_storage_optimization_history), [`INTERNAL_DATA_TRANSFER_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/internal_data_transfer_history), [`LISTING_AUTO_FULFILLMENT_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/organization-usage/listing_auto_fulfillment_usage_history), [`MARKETPLACE_PAID_USAGE_DAILY`](https://docs.snowflake.com/en/collaboration/views/marketplace-paid-usage-daily-org), [`MATERIALIZED_VIEW_REFRESH_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/materialized_view_refresh_history), [`METERING_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/metering_history), [`NOTEBOOKS_CONTAINER_RUNTIME_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/notebooks_container_runtime_history), [`OPENFLOW_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/openflow_usage_history), [`PIPE_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/pipe_usage_history), [`QUERY_ACCELERATION_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/query_acceleration_history), [`REPLICATION_GROUP_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/organization-usage/replication_group_usage_history), [`SEARCH_OPTIMIZATION_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/search_optimization_history), [`SERVERLESS_ALERT_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/serverless_alert_history), [`SERVERLESS_TASK_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/serverless_task_history), [`SNOWFLAKE_APP_RUNTIME_COMPUTE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/snowflake_app_runtime_compute_history), [`SNOWPARK_CONTAINER_SERVICES_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/snowpark_container_services_history), [`SNOWPIPE_STREAMING_CLIENT_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/snowpipe_streaming_client_history), [`SNOWPIPE_STREAMING_FILE_MIGRATION_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/snowpipe_streaming_file_migration_history), and [`USAGE_IN_CURRENCY_DAILY`](https://docs.snowflake.com/en/sql-reference/organization-usage/usage_in_currency_daily) |
| Storage and backup                   | [`ARCHIVE_STORAGE_DATA_RETRIEVAL_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/archive_storage_data_retrieval_usage_history), [`BACKUP_OPERATION_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/backup_operation_history), [`BACKUP_SETS`](https://docs.snowflake.com/en/sql-reference/account-usage/backup_sets), [`BACKUP_STORAGE_USAGE`](https://docs.snowflake.com/en/sql-reference/account-usage/backup_storage_usage), [`BLOCK_STORAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/block_storage_history), [`DATABASE_STORAGE_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/database_storage_usage_history), [`POSTGRES_STORAGE_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/postgres_storage_usage_history), [`STAGE_STORAGE_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/stage_storage_usage_history), [`STORAGE_LIFECYCLE_POLICY_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/storage_lifecycle_policy_history), [`STORAGE_REQUEST_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/storage_request_history), [`STORAGE_USAGE`](https://docs.snowflake.com/en/sql-reference/account-usage/storage_usage), and [`TABLE_STORAGE_METRICS`](https://docs.snowflake.com/en/sql-reference/account-usage/table_storage_metrics)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| Catalog and security snapshots       | [`COMPUTE_POOLS`](https://docs.snowflake.com/en/sql-reference/account-usage/compute_pools), [`DATABASES`](https://docs.snowflake.com/en/sql-reference/account-usage/databases), [`SCHEMATA`](https://docs.snowflake.com/en/sql-reference/account-usage/schemata), [`TABLES`](https://docs.snowflake.com/en/sql-reference/account-usage/tables), [`VIEWS`](https://docs.snowflake.com/en/sql-reference/account-usage/views), [`TASKS`](https://docs.snowflake.com/en/sql-reference/account-usage/tasks), [`PIPES`](https://docs.snowflake.com/en/sql-reference/account-usage/pipes), [`REPLICATION_GROUPS`](https://docs.snowflake.com/en/sql-reference/account-usage/replication_groups), [`SERVICES`](https://docs.snowflake.com/en/sql-reference/account-usage/services), [`USERS`](https://docs.snowflake.com/en/sql-reference/account-usage/users), [`GRANTS_TO_USERS`](https://docs.snowflake.com/en/sql-reference/account-usage/grants_to_users), [`GRANTS_TO_ROLES`](https://docs.snowflake.com/en/sql-reference/account-usage/grants_to_roles), and [`NETWORK_POLICIES`](https://docs.snowflake.com/en/sql-reference/account-usage/network_policies)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| Cortex and AI usage                  | [`CORTEX_AGENT_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/cortex_agent_usage_history), [`CORTEX_AI_FUNCTIONS_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/cortex_ai_functions_usage_history), [`CORTEX_AI_GUARDRAILS_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/cortex_ai_guardrails_usage_history), [`CORTEX_AISQL_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/cortex_aisql_usage_history), [`CORTEX_ANALYST_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/cortex_analyst_usage_history), [`CORTEX_CODE_CLI_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/cortex_code_cli_usage_history), [`CORTEX_CODE_DESKTOP_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/cortex_code_desktop_usage_history), [`CORTEX_CODE_SNOWSIGHT_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/cortex_code_snowsight_usage_history), [`CORTEX_DOCUMENT_PROCESSING_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/cortex_document_processing_usage_history), [`CORTEX_FINE_TUNING_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/cortex_fine_tuning_usage_history), [`CORTEX_FUNCTIONS_QUERY_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/cortex_functions_query_usage_history), [`CORTEX_FUNCTIONS_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/cortex_functions_usage_history), [`CORTEX_PROVISIONED_THROUGHPUT_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/cortex_provisioned_throughput_usage_history), [`CORTEX_REST_API_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/cortex_rest_api_usage_history), [`CORTEX_SEARCH_BATCH_QUERY_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/cortex_search_batch_query_usage_history), [`CORTEX_SEARCH_DAILY_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/cortex_search_daily_usage_history), [`CORTEX_SEARCH_SERVING_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/cortex_search_serving_usage_history), [`DOCUMENT_AI_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/document_ai_usage_history), and [`SNOWFLAKE_INTELLIGENCE_USAGE_HISTORY`](https://docs.snowflake.com/en/sql-reference/account-usage/snowflake_cowork_usage_history_view)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |

We take daily snapshots of catalog and security views so we can understand how the account changes over time. We also read warehouse settings through Snowflake's [warehouse API](https://docs.snowflake.com/en/developer-guide/snowflake-python-api/snowflake-python-managing-warehouses).
