SYSTEM$CLUSTERING_INFORMATION
functionsupportedTables, views, streams, sequencesReturns clustering information, including average clustering depth and Automatic Clustering version, for a table based on one or more columns in the table.
Syntax
supportedpartialnot supportednot scored
SYSTEM$CLUSTERING_INFORMATION( '<table_name>'
[ , { '( <expr1> [ , <expr2> ... ] )' | <number_of_errors> } ] )
Parameters
| Name | Required | Description |
|---|---|---|
table_name | required | Table for which you want to return clustering information. |
(expr1 [ , expr2 ... ]) | required | Column names or expressions for which clustering information is returned: For a table with no clustering key, this argument is required. If this argument is omitted, an error is returned. For a table with a clustering key, this argument is optional; if the argument is omitted, Snowflake uses the defined clustering key to return clustering information. Even if only one column name or expression is passed, it must be inside parentheses. Note You can use this argument to return clustering information for any columns in the table, regardless of whether a clustering key is defined for the table. In other words, you can use this to help you decide what clustering to use in the future. |
number_of_errors | required | Number of clustering errors returned by the function. If this argument is omitted, the 10 most recent errors are returned. |
Returns
The function returns a value of type VARCHAR. The returned string is in JSON format and contains the following name/value pairs: For more information about micro-partition overlap and depth, and their impact on query pruning, see Understanding Snowflake Table Structures.
Usage notes
- The second argument of the function specifies a column name/expression or a number of errors. You cannot include both arguments in a single function call.
- The table name, column name, and expression are strings, and should be enclosed in single quotes.
- For tables that use Optima Clustering, the following fields aren’t available: total_constant_partition_count
- partition_depth_histogram
- For more information about Optima Clustering, see Optima Clustering.
Limitations
If a table has more than 2 million partitions: - The results of the function are based on a subset of the table’s partitions. - The value of the output’s total_partition_count field is 2 million.