Schemas:

ACCOUNT_USAGE

TABLE_DML_HISTORY View

This Account Usage view can be used to determine the magnitude and effects of the DML operations performed on a table. Note that these DML operations include ones initiated by Snowpipe but exclude operations initiated by background maintenance services (e.g. Automatic Clustering, maintenance for materialized views and search optimization, etc.).

You can query this view with the QUERY_HISTORY View and the LOAD_HISTORY View to identify the DML operations that cause a significant amount of churn. This can help you to identify opportunities for optimization.

In addition, you can query this view with the AUTOMATIC_CLUSTERING_HISTORY View and the SEARCH_OPTIMIZATION_HISTORY View to visualize the relationship between these DML operations and the credits charged for Automatic Clustering and the search optimization service. (These services can be triggered by DML operations.)

Columns

Column Name

Data Type

Description

START_TIME

TIMESTAMP_LTZ

Start of the time range (on the hour mark) during which the DML operations were performed.

END_TIME

TIMESTAMP_LTZ

End of the time range (on the hour mark) during which the DML operations were performed.

TABLE_ID

NUMBER

Internal/system-generated identifier for the table modified by the DML operations.

TABLE_NAME

TEXT

Name of the table modified by the DML operations.

SCHEMA_ID

NUMBER

Internal/system-generated identifier for the schema that contains the table modified by the DML operations.

SCHEMA_NAME

TEXT

Name of the schema that contains the table modified by the DML operations.

DATABASE_ID

NUMBER

Internal/system-generated identifier for the database that contains the table modified by the DML operations.

DATABASE_NAME

TEXT

Name of the database that contains the table modified by the DML operations.

PARTITIONS_ADDED

NUMBER

Number of partitions added by DML operations performed by users on the table during the START_TIME and END_TIME window.

PARTITIONS_REMOVED

NUMBER

Number of partitions removed by DML operations performed by users on the table during the START_TIME and END_TIME window.

ROWS_ADDED

NUMBER

Number of rows added by DML operations performed by users on the table during the START_TIME and END_TIME window.

ROWS_REMOVED

NUMBER

Number of rows removed by DML operations performed by users on the table during the START_TIME and END_TIME window.

ROWS_UPDATED

NUMBER

Number of rows updated by DML operations performed by users on the table during the START_TIME and END_TIME window.

Usage Notes

  • Latency for the view may be up to 6 hours.

Examples

List the tables that have had the most partitions added and removed due to DML operations within the last 24 hours:

SELECT * FROM snowflake.account_usage.table_dml_history
WHERE start_time > DATEADD(hour, -24, CURRENT_TIMESTAMP())
ORDER BY partitions_added + partitions_removed DESC;
Copy