SYSTEM$ESTIMATE_AUTOMATIC_CLUSTERING_COSTS
functionsupportedTables, views, streams, sequencesReturns estimated costs associated with enabling Automatic Clustering for a table. This function is used to do the following: - Estimate the cost of clustering a table for the first time. - Estimate the cost of changing the cluster key of a table. - Estimate, when possible, the cost associated with maintaining the table after it’s clustered around the specified key. Sometimes, a table might need more DML history to estimate future maintenance costs. Important The cost estimates returned by the SYSTEM$ESTIMATE_AUTOMATIC_CLUSTERING_COSTS function are best efforts. The actual realized costs can vary by up to 100% (or, in rare cases, several times) from the estimated costs.
Syntax
supportedpartialnot supportednot scored
SYSTEM$ESTIMATE_AUTOMATIC_CLUSTERING_COSTS( '<table_name>' ,
[ '( <expr1> [ , <expr2> ... ] )' ] )
Parameters
| Name | Required | Description |
|---|---|---|
‘table_name’ | required | Name of the table for which you want to return the estimated cost of clustering. |
‘(expr1 [ , expr2 ... ])’ | required | The proposed cluster key for the table is where each expression resolves to a table column. The function estimates the cost of clustering the table using these columns as the cluster key. |
Returns
A value of type VARCHAR. The returned string is in JSON format and contains the following name/value pairs:
Usage notes
- The cost estimates returned by the SYSTEM$ESTIMATE_AUTOMATIC_CLUSTERING_COSTS function are based on sampling a subset of micro-partitions from your table and capturing the clustering execution time. Depending on sampled specific micro-partitions and the system speed, the cost estimates might differ between function executions.
- For the best possible accuracy, you can run SYSTEM$ESTIMATE_AUTOMATIC_CLUSTERING_COSTS multiple times and average the results. The function uses sample clustering jobs and collects their execution time. The provided cost estimate might fluctuate depending on the system speed. Running the function multiple times and averaging the results can produce a more accurate cost estimate.
- The most common reason for an inaccurate maintenance cost estimate is that the past DML patterns based on the estimate did not match future DML patterns.
- Snowflake is able to provide a one-time cost estimate in the vast majority of cases and a maintenance cost estimate in some cases. If the function is unable to provide a maintenance cost estimate, Snowflake includes a reason in the output.
Access control requirements
The privileges needed to estimate costs are the same as those required to read the table and change the cluster key. You need the following privileges: - SELECT and INSERT privileges on the table, or OWNERSHIP privilege on the table. - USAGE privilege or any other privilege on the parent schema and database.