Estimates the cost of executing an SQL job based on the amount of input data, number of user-defined functions (UDFs), and complexity of the SQL job. You cannot estimate the cost in scenarios where partition pruning is enabled for UDFs, because the number of partitions to be scanned cannot be determined.

Limits

You cannot use this statement to estimate the cost of SQL jobs that involve external tables.

Usage notes

The estimation result is for reference only. You can view your bill for the actual costs.

Syntax

cost sql <sql_sentence>;

Parameters

sql_sentence: the SQL statement for which you want to estimate the execution cost.

Examples

cost sql select * from sale_detail;
The following result is returned:
ID = 20150715113033121xxxxxxx
UDF:0
Complexity:1.0
Input:0 Bytes
Parameter description:
  • UDF: the number of UDFs that are used in an SQL job.
  • Complexity: the complexity of an SQL job. For more information, see SQL complexity.
  • Input: the amount of data scanned in an SQL job.