All Products
Search
Document Center

MaxCompute:COST SQL

Last Updated:Apr 27, 2026

Estimates the execution cost of an SQL job based on the size of the input data, the number of user-defined functions (UDFs), and the SQL complexity. Note: Cost estimation is not supported for UDFs that involve partition pruning because the number of partitions to scan cannot be determined.

Limitations

The COST SQL command does not support external tables.

Usage notes

The provided cost estimation is for reference only. For actual charges, refer to your bill.

Syntax

cost sql <sql_sentence>;

Parameters

sql_sentence: The SQL statement whose cost you want to estimate.

Example

cost sql select * from sale_detail;
The command returns the following output.
ID = 20150715113033121xxxxxxx
UDF:0
Complexity:1.0
Input:0 Bytes
The output includes the following parameters:
  • UDF: The number of UDFs executed by the SQL job.
  • Complexity: The SQL complexity. For more information, see SQL complexity.
  • Input: The amount of data scanned by the SQL job.