Compute billing (pay-as-you-go)

更新时间:
复制 MD 格式

With pay-as-you-go billing, MaxCompute charges for compute jobs including SQL, MapReduce, Spark, Mars (data science), Query Acceleration SQL, and MaxFrame. This topic describes the billing rules for each job type.

Background

MaxCompute uses job execution as the metering basis and charges you after a job is completed. Within a single region, an Alibaba Cloud account can purchase a pay-as-you-go quota only once.

MaxCompute currently charges for SQL, MapReduce, Spark, Mars (data science), Query Acceleration SQL, and MaxFrame jobs on a pay-as-you-go basis. If charges are introduced for other job types, we will provide separate announcements.

The billing methods for SQL, MapReduce, Spark, Mars, Query Acceleration SQL, and MaxFrame jobs are detailed below:

PyODPS tasks run as SQL jobs internally and are billed accordingly. For information about billing for other job types, see official Alibaba Cloud announcements.

Pay-as-you-go SQL jobs

For each SQL job you run, MaxCompute calculates the fee based on the input data size and SQL complexity. The system aggregates the fees for all successful SQL jobs within a project and adds the total to your bill on the following day before 06:00. The cost is then automatically deducted from your account balance.

Note
  • You are not charged for failed SQL jobs.

  • Similar to storage, the input data size for an SQL job is calculated based on the compressed data size.

  • In bills and downloaded data records, the data size is measured in bytes. To convert this to gigabytes (GB), divide the value by 1024³.

SQL job cost estimation methods

SQL cost estimation helps predict fees and prevent unexpectedly high charges. The estimated cost may differ from the actual cost.

The final bill reflects the actual charges.

The following methods are available for estimating SQL costs.

  • Use DataWorks to develop SQL

    The cost estimation feature in the GUI estimates fees. For more information, see Use DataWorks to develop SQL.

  • Use IntelliJ IDEA

    The cost is automatically estimated when committing an SQL script. For more information, see Develop and commit SQL scripts.

  • During SQL development

    Call the SQLCostTask API to estimate the SQL cost. For more information, see ODPS SDK.

  • In a production environment

    Before you deploy an analytical SQL job, you can estimate its cost using the Cost SQL command. For more information, see Metering estimation.

Note
  • Cost estimation is not supported for SQL jobs that involve external tables.

  • To prevent high daily spending, configure spending alerts in CloudMonitor. Setting a daily spending limit for each project allows you to monitor costs and avoid unexpected charges. For more information, see Consumption monitoring and cost control.

SQL job billing rules

The following table describes the billing rules for different types of SQL jobs.

Type

Billing formula

Price

Description

Standard SQL jobs

Total daily fee for SQL jobs = Input data size × SQL complexity × Unit price

  • If the daily metered data volume is 100 TB or less, the unit prices are as follows:

    • public cloud: CNY 0.3/GB

    • financial cloud: CNY 0.57/GB

    Note

    Daily metered data volume = Input data size × SQL complexity

  • If the daily metered data volume is greater than 100 TB, the unit prices for the excess amount are as follows:

    • public cloud: CNY 0.285/GB

    • financial cloud: CNY 0.5415/GB

  • If the daily metered data volume is greater than 500 TB, the unit prices for the excess amount are as follows:

    • public cloud: CNY 0.27/GB

    • financial cloud: CNY 0.513/GB

Pay-As-You-Go Standard Edition

SpotSQL jobs

Total daily fee for SQL jobs = Input data size × SQL complexity × Unit price

In most cases, the unit prices are as follows:

  • public cloud: CNY 0.1/GB

  • financial cloud: CNY 0.19/GB

Pay-As-You-Go Spot Edition

SQL jobs that query external tables, including:

  • OSS external table jobs

  • Tablestore (OTS) external table jobs

  • Hologres external table jobs

  • HBase external table jobs

  • JDBC (such as RDS) external table jobs

  • HDFS external table jobs

  • OSSHDFS external table jobs

  • Object Table jobs

Total daily fee for SQL jobs = Input logical data size × SQL complexity × Unit price

In most cases, the unit prices are as follows:

  • public cloud: CNY 0.03/GB

  • financial cloud: CNY 0.057/GB

Billing for external tables started on October 31, 2018. For more information, see External tables.

  • If you use Tablestore and OSS services with MaxCompute, the following billing rules apply:

    • When you run an SQL job, if you access Tablestore over the public internet, an internal Alibaba Cloud network, or a VPC, Tablestore-related fees are incurred. This does not apply to access by using Security Token Service (STS). For more information, see Tablestore pricing.

    • When you run an SQL job, you are charged for the outbound traffic if you access OSS over the public internet. Accessing OSS over an internal Alibaba Cloud network or a VPC is free. Additional fees may apply if you call OSS APIs. For more information, see OSS pricing.

  • If an SQL job queries both internal and external tables, the two parts are billed separately.

Developer Edition SQL jobs

Total daily fee for SQL jobs = Input data size × Unit price

In most cases, the unit prices are as follows:

  • public cloud: CNY 0.15/GB

  • financial cloud: Not applicable.

The Pay-As-You-Go Developer Edition provides a CNY 100 discount on compute fees for each project every month.

Note

The Pay-As-You-Go Developer Edition is no longer available for new purchases and was discontinued at 00:00:00 on October 31, 2023 (Tuesday, UTC+8). For more information, see [Notice] MaxCompute Discontinues the Sales of Specific Instance Editions from September 23, 2022.

  • Input data size: The amount of data that an SQL job actually scans. For most SQL jobs that use partition pruning and column pruning, this value is much smaller than the size of the source table.

    • Partition pruning: For example, if an SQL statement includes the clause WHERE ds > 20130101, where ds is a partition column, only the data in the partitions that meet the condition is billed. Data in other partitions is excluded.

    • Column pruning: For example, for the SQL statement SELECT f1,f2,f3 FROM t1;, only the data in columns f1, f2, and f3 of table t1 is included in the billing. Other columns are not billed.

    • Logical size: The data size before compression and encoding.

  • SQL complexity: The system calculates the SQL complexity based on the number of specific keywords in an SQL statement.

    • Count the SQL keywords.

      Number of SQL keywords = Number of JOINs + Number of GROUP BYs + Number of ORDER BYs + Number of DISTINCTs + Number of window functions + MAX((Number of INSERTs | Number of UPDATEs | Number of DELETEs), 1). For more information about these keywords, see JOIN, GROUP BY, ORDER BY, window function, INSERT, and UPDATE|DELETE.

      Note

      If the number of SQL keywords is significantly higher than 20, parsing can take a long time and cause the job to remain in a queued state. We recommend that you optimize your SQL to reduce the number of keywords.

    • Calculate SQL complexity.

      • If the keyword count is 3 or less, the complexity is 1.

      • If the keyword count is between 4 and 6 (inclusive), the complexity is 1.5.

      • If the keyword count is between 7 and 19 (inclusive), the complexity is 2.

      • If the keyword count is 20 or more, the complexity is 4.

SQL job billing example

Consider the following SQL statement:

SELECT DISTINCT total1 
  FROM(SELECT id1, 
              COUNT(f1) AS total1 
          FROM in1 
          GROUP BY id1
       ) tmp1
  ORDER BY total1 DESC 
  LIMIT 100;
  • Number of DISTINCT: 1

  • Number of GROUP BY: 1

  • Number of ORDER BY: 1

  • MAX((Number of INSERTs | Number of UPDATEs | Number of DELETEs), 1) = MAX(0|0|0, 1) = 1

  • Total number of SQL keywords = 1 + 1 + 1 + 1 = 4

The total keyword count is 4, which falls into the range of 4 to 6. Therefore, the SQL complexity is 1.5.

Pay-as-you-go MapReduce jobs

After a MapReduce job runs successfully, the system calculates the fee based on the compute hours consumed. The system aggregates the fees for all successful MapReduce jobs and adds the total to your bill on the following day before 06:00. The cost is then automatically deducted from your account balance.

  • You are not charged for failed MapReduce jobs.

  • You are not charged for the time a job spends in the queue.

  • The cost of the same job may vary slightly due to fluctuations in the cluster load.

  • One Compute Unit (CU) is equivalent to 1 CPU core-hour and 4 GB-hours of memory. Compute hours are calculated using the greater value between CPU and memory consumption over time, based on the formula: MAX(CPU Cores × Hours, CEILING(Memory in GB × Hours / 4)).

  • If you have a MaxCompute subscription, you can run MapReduce jobs for free within the scope of your subscription plan.

If you have any questions about MapReduce job billing, you can submit a ticket to contact MaxCompute technical support.

MapReduce job billing rules

Billing formula

Type

Price

Description

Example

  • Total daily compute fee for MapReduce jobs = Total daily compute hours × Unit price

  • Compute hours for a single job = MAX(CPU Cores × Hours, CEILING(Memory in GB × Hours / 4))

Standard MapReduce jobs

In most cases, the unit prices are as follows:

  • public cloud: CNY 0.36/compute hour

  • financial cloud: CNY 0.684/compute hour

Starting from August 16, 2017, MaxCompute began billing for MapReduce jobs on a pay-as-you-go basis. By default, a Map or Reduce job uses 2 cores and 3 GB of memory.

A MapReduce job uses 2 cores and 10 GB of memory for 1 hour. The compute hours are calculated as MAX(2 × 1, CEILING(10 × 1 / 4)) = MAX(2, 3) = 3.

The total compute fee for the MapReduce job is calculated as follows:

  • public cloud: 3 × 0.36 = CNY 1.08

  • financial cloud: 3 × 0.684 = CNY 2.052

Spot MapReduce jobs

In most cases, the unit prices are as follows:

  • public cloud: CNY 0.154/compute hour

  • financial cloud: CNY 0.293/compute hour

A Spot MapReduce job uses 2 cores and 10 GB of memory for 1 hour. The compute hours are calculated as MAX(2 × 1, CEILING(10 × 1 / 4)) = MAX(2, 3) = 3.

The total compute fee for the Spot MapReduce job is calculated as follows:

  • public cloud: 3 × 0.154 = CNY 0.462

  • financial cloud: 3 × 0.293 = CNY 0.879

Pay-as-you-go Query Acceleration SQL jobs (applicable only to MCQA)

For each Query Acceleration job you run, MaxCompute calculates the fee based on its input data size. The system aggregates the fees for all Query Acceleration jobs and adds the total to your bill on the following day before 06:00. The cost is then automatically deducted from your account balance.

Important

The pay-as-you-go billing method for Query Acceleration jobs is available in the China (Hangzhou), China (Shanghai), China (Beijing), China (Zhangjiakou), China (Ulanqab), China (Shenzhen), and China (Chengdu) regions. This service is being gradually rolled out to other regions.

  • MaxCompute uses columnar storage and data compression by default. The scanned data size is calculated based on the compressed data size.

  • You are not charged for canceled Query Acceleration jobs.

  • No fees are incurred if you do not run any queries.

  • When you query a partitioned table, you can use partition pruning conditions to reduce the amount of scanned data and improve query performance.

  • If you have a subscription plan, you can allocate a portion of your quota resources exclusively for Query Acceleration jobs. For more information, see MaxQA overview.

Billing rules

Billing formula

Price

Description

Fee for one Query Acceleration job = Input data size × SQL complexity × Unit price

In most cases, the unit prices are as follows:

  • public cloud: CNY 0.3/GB

  • financial cloud: CNY 0.57/GB

Starting from October 12, 2020, MaxCompute began billing for Query Acceleration jobs on a pay-as-you-go basis. For more information, see MaxQA overview.

Pay-as-you-go Spark jobs

After a Spark job runs successfully, the system calculates the fee based on the compute hours consumed. The system aggregates the fees for all Spark jobs and adds the total to your bill on the following day before 06:00. The cost is then automatically deducted from your account balance.

Important

The pay-as-you-go billing method for Spark jobs is available in the China (Hangzhou), China (Beijing), and China (Shenzhen) regions. This service is being gradually rolled out to other regions.

  • You are not charged for the time a job spends in the queue.

  • The cost of the same job may vary depending on the amount of resources you specify.

  • If you have a MaxCompute subscription, you can run Spark jobs for free within the scope of your subscription plan.

If you have any questions about Spark job billing, you can submit a ticket to contact MaxCompute technical support.

Spark job billing rules

Billing formula

Type

Price

Description

Example

Total daily compute fee for Spark jobs = Total daily compute hours × Unit price

Standard Spark jobs

In most cases, the unit prices are as follows:

  • public cloud: CNY 0.36/compute hour

  • financial cloud: CNY 0.684/compute hour

Starting from February 1, 2019, MaxCompute began billing for Spark jobs on a pay-as-you-go basis. For more information, see Spark on MaxCompute.

The compute hours for a Spark job are calculated as follows:

  • The calculation is based on the number of CPU cores and the amount of memory consumed.

  • One compute hour is equivalent to 1 CPU Core-hour and 4 GB-hours of memory.

  • The formula is MAX(CPU Cores × Hours, CEILING(Memory in GB × Hours / 4)).

A Spark job uses 2 CPU cores and 5 GB of memory and runs for 1 hour. The compute hours are calculated as MAX(2 × 1, CEILING(5 × 1 / 4)) = 2.

The compute fee for the Spark job is 2 × 0.36 = CNY 0.72 on the public cloud and 2 × 0.684 = CNY 1.368 on the financial cloud.

Spot Spark jobs

In most cases, the unit prices are as follows:

  • public cloud: CNY 0.22/compute hour

  • financial cloud: CNY 0.418/compute hour

A Spot Spark job uses 2 CPU cores and 5 GB of memory and runs for 1 hour. The compute hours are calculated as MAX(2 × 1, CEILING(5 × 1 / 4)) = 2.

The compute fee for the Spot Spark job is 2 × 0.22 = CNY 0.44 on the public cloud and 2 × 0.418 = CNY 0.836 on the financial cloud.

Pay-as-you-go Mars (data science) jobs

After a Mars job runs successfully, the system calculates the fee based on the compute hours consumed. The system aggregates the fees for all Mars jobs and adds the total to your bill on the following day before 06:00. The cost is then automatically deducted from your account balance.

Important

The pay-as-you-go billing method for Mars jobs is available in the China (Hangzhou), China (Shanghai), China (Beijing), China (Zhangjiakou), China (Ulanqab), China (Shenzhen), China (Chengdu), and China (Hong Kong) regions. This service is being gradually rolled out to other regions.

  • You are not charged for the time a job spends in the queue.

  • The cost of the same job may vary depending on the amount of resources you specify.

  • If you have a MaxCompute subscription, you can run Mars jobs for free within the scope of your subscription plan.

If you have any questions about Mars job billing, you can submit a ticket to contact MaxCompute technical support.

Mars job billing rules

Billing formula

Type

Price

Description

Example

Total daily compute fee for Mars jobs = Total daily compute hours × Unit price

Standard Mars jobs

In most cases, the unit prices are as follows:

  • public cloud: CNY 0.66/compute hour

  • financial cloud: CNY 1.254/compute hour

Starting from September 1, 2020, MaxCompute began billing for Mars jobs on a pay-as-you-go basis. For more information, see Data science (Mars).

The compute hours for a Mars job are calculated as follows:

  • The calculation is based on the number of CPU cores and the amount of memory consumed.

  • One compute hour is equivalent to 1 CPU Core-hour and 4 GB-hours of memory.

  • The formula is MAX(CPU Cores × Hours, CEILING(Memory in GB × Hours / 4)).

A Mars job uses 2 CPU cores and 5 GB of memory and runs for 1 hour. The compute hours are calculated as MAX(2 × 1, CEILING(5 × 1 / 4)) = 2.

The compute fee for the Mars job is 2 × 0.66 = CNY 1.32 on the public cloud and 2 × 1.254 = CNY 2.508 on the financial cloud.

Spot Mars jobs

In most cases, the unit prices are as follows:

  • public cloud: CNY 0.22/compute hour

  • financial cloud: CNY 0.418/compute hour

A Spot Mars job uses 2 CPU cores and 5 GB of memory and runs for 1 hour. The compute hours are calculated as MAX(2 × 1, CEILING(5 × 1 / 4)) = 2.

The compute fee for the Spot Mars job is 2 × 0.22 = CNY 0.44 on the public cloud and 2 × 0.418 = CNY 0.836 on the financial cloud.

Pay-as-you-go MaxFrame jobs

After a MaxFrame job runs, the system calculates the fee based on the CU hours (compute hours) consumed. The system aggregates the fees for all MaxFrame jobs and adds the total to your bill on the following day before 06:00. The cost is then automatically deducted from your account balance.

Important

The pay-as-you-go billing method for MaxFrame jobs is available in the China (Hangzhou), China (Beijing), China (Shenzhen), China (Shanghai), China (Chengdu), and China (Hong Kong) regions. This service is being gradually rolled out to other regions.

If you have a MaxCompute subscription, you can run MaxFrame jobs for free within the scope of your subscription plan.

If you have any questions or require assistance with MaxFrame job billing, you can submit a ticket to contact MaxCompute technical support.

MaxFrame job billing rules

Billing formula

Type

Price

Description

Example

Total daily compute fee for MaxFrame jobs = Total daily CU hours × Unit price

Standard MaxFrame jobs

In most cases, the unit prices are as follows:

  • public cloud: CNY 0.36/compute hour

  • financial cloud: CNY 0.684/compute hour

The CU hours for a MaxFrame job are calculated as follows:

  • The calculation is based on the number of CPU cores and the amount of memory consumed.

  • One compute hour is equivalent to 1 CPU Core-hour and 4 GB-hours of memory.

  • The formula is MAX(CPU Cores × Hours, CEILING(Memory in GB × Hours / 4)).

A MaxFrame job uses 2 CPU cores and 5 GB of memory and runs for 1 hour. The CU hours are calculated as MAX(2 × 1, CEILING(5 × 1 / 4)) = 2.

The compute fee for the MaxFrame job is 2 × 0.36 = CNY 0.72 on the public cloud and 2 × 0.684 = CNY 1.368 on the financial cloud.

Related documents