Estimates the execution cost of a SQL job based on the amount of input data, the number of user-defined functions (UDFs), and query complexity.
Limitations
COST SQL does not support the following scenarios:
External tables: COST SQL cannot estimate the cost of SQL jobs that involve external tables.
UDF partition pruning: COST SQL cannot estimate the cost when partition pruning is enabled for UDFs, because the number of partitions to scan cannot be determined.
Usage notes
The estimation result is for reference only. Check your bill for actual costs.
Syntax
cost sql <sql_sentence>;Parameters
| Parameter | Description |
|---|---|
sql_sentence | The SQL statement to estimate execution cost for. |
Example
The following example estimates the cost of a SELECT * query on the sale_detail table.
cost sql select * from sale_detail;Output:
ID = 20150715113033121xxxxxxx
UDF:0
Complexity:1.0
Input:0 BytesThe output fields are described in the following table.
| Field | Description |
|---|---|
UDF | The number of UDFs used in the SQL job. |
Complexity | The complexity score of the SQL job. For more information, see SQL complexitySQL complexity. |
Input | The amount of data scanned in the SQL job. |