All Products
Search
Document Center

MaxCompute:COST SQL

Last Updated:Jul 17, 2026

Estimates the execution cost of an SQL job based on input data size, the number of user-defined functions (UDFs), and SQL complexity. 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

Cost estimates are 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;
Sample output:
ID = 20150715113033121xxxxxxx
UDF:0
Complexity:1.0
Input:0 Bytes
The output contains the following fields:
  • UDF: The number of UDFs in the SQL job.
  • Complexity: The SQL complexity. For more information, see SQL complexity.
  • Input: The amount of data scanned by the job.