Billing command references

Updated at:

Use this reference to check whether a MaxCompute command incurs charges before running it.

This table does not cover all commands and is updated on a rolling basis. Actual charges are based on your bills, not this table.

How billing works

Most commands fall into one of two categories:

  • Compute commands — commands that read or process data (such as SELECT, INSERT, and JAR MR) consume compute resources and are charged.

  • Management commands — commands that manage metadata, resources, or sessions (such as CREATE TABLE, DROP TABLE, and SET) do not trigger computation and are free.

The same command can have different billing status depending on how it is used. For example, TUNNEL DOWNLOAD is free when using an intranet endpoint, but incurs charges when using a public (Internet) endpoint.

Command billing reference

Command Description Charged
TUNNEL DOWNLOAD (intranet) Downloads data using an intranet Tunnel endpoint No
TUNNEL DOWNLOAD (Internet) Downloads data using a public Tunnel endpoint Yes
TUNNEL UPLOAD Uploads data using Tunnel resource groups No
COST SQL Estimates the compute cost of a SQL statement No
INSERT OVERWRITE...SELECT Overwrites table data with query results Yes
DESC TABLE Displays table schema and metadata No
DROP TABLE Drops a table No
CREATE TABLE Creates an empty table No
CREATE TABLE...AS SELECT Creates a table from a SELECT statement (CTAS) Yes
INSERT INTO TABLE...VALUES Inserts constant values into a table Yes
INSERT INTO TABLE...SELECT Inserts query results into a table Yes
SELECT (with UDF or aggregation) Queries data from a table Yes
SET Configures session-level settings No
JAR MR Runs a MapReduce job Yes
ADD JAR/FILE/ARCHIVE/TABLE Adds a resource No
DROP RESOURCE Drops a resource No
GET RESOURCE Downloads a resource No
LIST RESOURCES Lists all resources No
CREATE FUNCTION Creates a user-defined function (UDF) No
DROP FUNCTION Drops a function No
LIST FUNCTIONS Lists all functions No
ALTER TABLE...DROP PARTITION Drops a partition from a table No
TRUNCATE TABLE Removes all data from a non-partitioned table No
CREATE EXTERNAL TABLE Creates an external table No
SELECT...FROM (external table) Reads data from an external table Yes
SHOW TABLES Lists all tables in the current project No
SHOW PARTITIONS Lists all partitions of a table No
SHOW INSTANCES / SHOW P Lists instances created by the current user No
WAIT INSTANCE Returns the LogView URL for a specified instance No
STATUS INSTANCE Returns the status of a specified instance No
KILL INSTANCE Stops a specified instance No

Examples

TUNNEL DOWNLOAD — intranet (free)

Configure an intranet Tunnel endpoint to avoid data transfer charges:

TUNNEL DOWNLOAD table_name e:/table_name.txt;

Set the Tunnel endpoint to an intranet address, for example:

https://dt.cn-shanghai-intranet.maxcompute.aliyun-inc.com

For intranet endpoint addresses by region, see the "Endpoints in different regions (classic network)" section in Endpoints.

TUNNEL DOWNLOAD — Internet (charged)

When using a public Tunnel endpoint, data transfer over the Internet incurs charges:

TUNNEL DOWNLOAD table_name e:/table_name.txt;

Set the Tunnel endpoint to a public address, for example:

http://dt.cn-shanghai.maxcompute.aliyun.com

For public endpoint addresses by region, see the "Endpoints in different regions (Internet)" section in Endpoints.

TUNNEL UPLOAD (free)

TUNNEL UPLOAD e:/table_name.txt table_name;

COST SQL (free)

Estimate compute cost before running a query:

COST SQL SELECT * FROM table_name;

INSERT OVERWRITE...SELECT (charged)

INSERT OVERWRITE TABLE table_name PARTITION (sale_date='20180122')
  SELECT shop_name, customer_id, total_price
  FROM sale_detail;

DESC TABLE (free)

DESC table_name;

DROP TABLE (free)

DROP TABLE IF EXISTS table_name;

CREATE TABLE (free)

CREATE TABLE IF NOT EXISTS table_name (
  key    STRING,
  value  BIGINT
) PARTITIONED BY (p STRING);

CREATE TABLE...AS SELECT (charged)

CREATE TABLE IF NOT EXISTS table_name AS
  SELECT * FROM a_tab;

INSERT INTO TABLE...VALUES (charged)

INSERT INTO TABLE table_name PARTITION (p)(key, p)
VALUES ('d', '20170101'), ('e', '20170101'), ('f', '20170101');

INSERT INTO TABLE...SELECT (charged)

INSERT INTO TABLE table_name
  SELECT shop_name, customer_id, total_price
  FROM sale_detail;

SELECT with UDF or aggregation (charged)

SELECT sum(a) FROM table_name;

SET (free)

SET odps.sql.allow.fullscan=true;

JAR MR (charged)

JAR -l com.aliyun.odps.mapred.example.WordCount wc_in wc_out

ADD JAR/FILE/ARCHIVE/TABLE (free)

ADD JAR data\resources\mapreduce-examples.jar -f;

DROP RESOURCE (free)

DROP RESOURCE sale.res

GET RESOURCE (free)

GET RESOURCES odps-udf-examples.jar d:\;

LIST RESOURCES (free)

LIST RESOURCES;

CREATE FUNCTION (free)

CREATE FUNCTION test_lower;

DROP FUNCTION (free)

DROP FUNCTION test_lower;

LIST FUNCTIONS (free)

LIST FUNCTIONS;

ALTER TABLE...DROP PARTITION (free)

ALTER TABLE user DROP IF EXISTS PARTITION (region='hangzhou', dt='20150923');

TRUNCATE TABLE (free)

TRUNCATE TABLE table_name;

CREATE EXTERNAL TABLE (free)

CREATE EXTERNAL TABLE IF NOT EXISTS ambulance_data_csv_external
  ...
  LOCATION 'oss://oss-cn-shanghai-internal.aliyuncs.com/oss-odps-test/Demo/'

SELECT...FROM external table (charged)

SELECT recordId, patientId, direction
FROM ambulance_data_csv_external
WHERE patientId > 25;

SHOW TABLES (free)

SHOW TABLES;

SHOW PARTITIONS (free)

SHOW PARTITIONS table_name;

SHOW INSTANCES / SHOW P (free)

SHOW INSTANCES;
SHOW P;

WAIT INSTANCE (free)

WAIT 20131225123302267gk3u6k4y2;

STATUS INSTANCE (free)

STATUS 20131225123302267gk3u6k4y2;

KILL INSTANCE (free)

KILL 20131225123302267gk3u6k4y2;