全部產品
Search
文件中心

MaxCompute:UNLOAD

更新時間:Feb 07, 2026

UNLOAD 命令用於將 MaxCompute 專案中的資料匯出至外部儲存(OSS、Hologres),供其他計算引擎使用。

許可權要求

  • MaxCompute 許可權:操作帳號需要具備 MaxCompute 專案中待匯出表資料的讀取許可權(Select)。授權操作請參見MaxCompute許可權

  • 外部儲存許可權:從 MaxCompute 匯出資料至外部儲存前,需要先對外部儲存(OSS 或 Hologres)進行授權,允許 MaxCompute 訪問外部儲存。

    • OSS 授權:支援一鍵授權,具備更高安全性。詳情請參見STS模式授權。樣本採用一鍵授權方式,角色名稱定義為AliyunODPSDefaultRole

    • Hologres 授權:需要建立一個 RAM 角色,為其授權允許 MaxCompute 訪問的許可權,並將角色添加至 Hologres 執行個體,完成授權。操作詳情請參見建立Hologres外部表格(STS模式)

匯出至外部儲存

UNLOAD 命令採用追加模式。重複向同一目標路徑匯出資料時,系統不會覆蓋已有的檔案,而是在該路徑下產生新的檔案。若需覆蓋,請在執行 UNLOAD 前手動清理目標路徑。

匯出至OSS

匯出為文字格式設定(CSV / TSV)

此方式使用內建的 StorageHandler 匯出資料,預設會為檔案添加 .csv 或 .tsv 尾碼。

文法

UNLOAD FROM {<select_statement>|<table_name> [PARTITION (<pt_spec>)]} 
INTO 
LOCATION <oss_location>
STORED BY <StorageHandler>
[WITH SERDEPROPERTIES ('<property_name>'='<property_value>',...)];

核心配置

配置項

說明

oss_location

目標OSS路徑,格式為oss://<oss_endpoint>/<bucket>/<object_path>

StorageHandler

指定內建處理器:

  • 'com.aliyun.odps.CsvStorageHandler':匯出為 CSV 格式。

  • 'com.aliyun.odps.TsvStorageHandler':匯出為 TSV 格式。

SERDEPROPERTIES

用於設定匯出屬性,最常用的是:

  • 'odps.properties.rolearn':必填,用於訪問 OSS 的 RAM 角色 ARN。

  • 'odps.text.option.gzip.output.enabled'='true':將匯出檔案壓縮為 GZIP 格式。

使用樣本

樣本1:匯出 CSV 格式並壓縮為 GZIP

將 MaxCompute 專案中表sale_detail的資料匯出至 OSS。sale_detail的資料如下:

-- 分區欄位:sale_date、region
+------------+-------------+-------------+------------+------------+
| shop_name  | customer_id | total_price | sale_date  | region     |
+------------+-------------+-------------+------------+------------+
| s1         | c1          | 100.1       | 2013       | china      |
| s2         | c2          | 100.2       | 2013       | china      |
| s3         | c3          | 100.3       | 2013       | china      |
| null       | c5          | NULL        | 2014       | shanghai   |
| s6         | c6          | 100.4       | 2014       | shanghai   |
| s7         | c7          | 100.5       | 2014       | shanghai   |
+------------+-------------+-------------+------------+------------+

操作步驟

  1. OSS 側:登入OSS管理主控台,建立 OSS Bucket 目錄mc-unload/data_location/,地區為oss-cn-hangzhou,並構造 OSS 路徑。更多建立 OSS Bucket 資訊,請參見控制台建立儲存空間。根據 Bucket、地區、Endpoint 資訊構造 OSS 路徑如下:

    oss://oss-cn-hangzhou-internal.aliyuncs.com/mc-unload/data_location
  2. MaxCompute 側:登入 MaxCompute用戶端,執行 UNLOAD 命令。

    方式1:使用 SELECT 查詢

    -- 設定單個 Worker 讀取 MaxCompute 表資料的大小為 256MB,用於控制匯出檔案個數。
    SET odps.stage.mapper.split.size=256;
    
    UNLOAD FROM (SELECT * FROM sale_detail)
    INTO
    LOCATION 'oss://oss-cn-hangzhou-internal.aliyuncs.com/mc-unload/data_location'
    STORED BY 'com.aliyun.odps.CsvStorageHandler'
    WITH SERDEPROPERTIES (
        'odps.properties.rolearn'='acs:ram::<uid>:role/AliyunODPSDefaultRole', 
        'odps.text.option.gzip.output.enabled'='true'
    );

    方式2:直接指定表名(不產生查詢費用)

    -- 設定單個 Worker 讀取 MaxCompute 表資料的大小為 256MB,用於控制匯出檔案個數。
    SET odps.stage.mapper.split.size=256;
    
    UNLOAD FROM sale_detail 
    INTO
    LOCATION 'oss://oss-cn-hangzhou-internal.aliyuncs.com/mc-unload/data_location'
    STORED BY 'com.aliyun.odps.CsvStorageHandler'
    WITH SERDEPROPERTIES (
        'odps.properties.rolearn'='acs:ram::<uid>:role/AliyunODPSDefaultRole', 
        'odps.text.option.gzip.output.enabled'='true'
    );
  3. 驗證結果:登入OSS管理主控台,查看目標 OSS 路徑的匯入結果。匯出的檔案為 CSV 格式,並壓縮為 GZIP 格式。

樣本2:匯出分區資料為 TSV 格式並壓縮

sale_detail表中分區為sale_date='2013'region='china'的資料匯出為 TSV 格式並壓縮為 GZIP。

-- 分區欄位:sale_date、region
+------------+-------------+-------------+------------+------------+
| shop_name  | customer_id | total_price | sale_date  | region     |
+------------+-------------+-------------+------------+------------+
| s1         | c1          | 100.1       | 2013       | china      |
| s2         | c2          | 100.2       | 2013       | china      |
| s3         | c3          | 100.3       | 2013       | china      |
| null       | c5          | NULL        | 2014       | shanghai   |
| s6         | c6          | 100.4       | 2014       | shanghai   |
| s7         | c7          | 100.5       | 2014       | shanghai   |
+------------+-------------+-------------+------------+------------+

操作步驟

  1. OSS 側:登入OSS管理主控台,建立 OSS Bucket 目錄mc-unload/data_location/,地區為oss-cn-hangzhou,並構造 OSS 路徑。更多建立 OSS Bucket 資訊,請參見控制台建立儲存空間。根據 Bucket、地區、Endpoint 資訊構造 OSS 路徑如下:

    oss://oss-cn-hangzhou-internal.aliyuncs.com/mc-unload/data_location
  2. MaxCompute 側:登入 MaxCompute用戶端,執行 UNLOAD 命令。

    SET odps.stage.mapper.split.size=256;
    
    UNLOAD FROM sale_detail PARTITION (sale_date='2013',region='china')
    INTO
    LOCATION 'oss://oss-cn-hangzhou-internal.aliyuncs.com/mc-unload/data_location'
    STORED BY 'com.aliyun.odps.TsvStorageHandler'
    WITH SERDEPROPERTIES (
        'odps.properties.rolearn'='acs:ram::<uid>:role/AliyunODPSDefaultRole', 
        'odps.text.option.gzip.output.enabled'='true'
    );
  3. 驗證結果:登入OSS管理主控台,查看目標 OSS 路徑的匯入結果。匯出的檔案為 TSV 格式,並壓縮為 GZIP 格式。

匯出為開源格式(Parquet / ORC 等)

此方式支援將資料匯出為多種開源列式儲存或結構化資料格式。

文法

UNLOAD FROM {<select_statement>|<table_name> [PARTITION (<pt_spec>)]}
INTO 
LOCATION <oss_location>
[ROW FORMAT SERDE '<serde_class>' 
  [WITH SERDEPROPERTIES ('<property_name>'='<property_value>',...)]
]
STORED AS <file_format>
[PROPERTIES ('<tbproperty_name>'='<tbproperty_value>')];

核心配置

配置項

說明

oss_location

目標OSS路徑,格式為oss://<oss_endpoint>/<bucket>/<object_path>

serde_class

指定序列化/還原序列化庫,例如 org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe 用於 Parquet。

SERDEPROPERTIES

'odps.properties.rolearn':必填,用於訪問 OSS 的 RAM 角色 ARN。

file_format

必填。指定檔案格式,如 PARQUE、 OR、 TEXTFIL、 JSON 等。

PROPERTIES

'mcfed.parquet.compression'='SNAPPY':為 Parquet 檔案指定壓縮格式(支援 SNAPP、 LZO)。
'odps.text.option.gzip.output.enabled'='true':為 TextFile 指定 GZIP 壓縮。

支援的格式和壓縮

檔案格式

支援的壓縮格式

說明

PARQUET

SNAPPY、LZO

列式儲存格式,適合分析型查詢

ORC

SNAPPY、LZO

列式儲存格式,適合 Hadoop 生態

TEXTFILE

GZIP

文字格式設定,支援自訂分隔字元

RCFILE

-

行列混合儲存格式

SEQUENCEFILE

-

Hadoop 序列檔案格式

AVRO

-

資料序列化格式

JSON

-

JSON 格式

使用樣本

樣本1:匯出 PARQUET 格式並壓縮為 SNAPPY

將 MaxCompute 專案中表sale_detail的資料匯出至 OSS。sale_detail的資料如下:

-- 分區欄位:sale_date、region
+------------+-------------+-------------+------------+------------+
| shop_name  | customer_id | total_price | sale_date  | region     |
+------------+-------------+-------------+------------+------------+
| s1         | c1          | 100.1       | 2013       | china      |
| s2         | c2          | 100.2       | 2013       | china      |
| s3         | c3          | 100.3       | 2013       | china      |
| null       | c5          | NULL        | 2014       | shanghai   |
| s6         | c6          | 100.4       | 2014       | shanghai   |
| s7         | c7          | 100.5       | 2014       | shanghai   |
+------------+-------------+-------------+------------+------------+

操作步驟

  1. OSS 側:登入OSS管理主控台,建立 OSS Bucket 目錄mc-unload/data_location/,地區為oss-cn-hangzhou,並構造 OSS 路徑。更多建立 OSS Bucket 資訊,請參見控制台建立儲存空間。根據 Bucket、地區、Endpoint 資訊構造 OSS 路徑如下:

    oss://oss-cn-hangzhou-internal.aliyuncs.com/mc-unload/data_location
  2. MaxCompute 側:登入 MaxCompute用戶端,執行 UNLOAD 命令。

    -- 設定單個 Worker 讀取 MaxCompute 表資料的大小為 256MB,用於控制匯出檔案個數。
    SET odps.stage.mapper.split.size=256;
    
    UNLOAD FROM (SELECT * FROM sale_detail) 
    INTO  
    LOCATION 'oss://oss-cn-hangzhou-internal.aliyuncs.com/mc-unload/data_location' 
    ROW FORMAT SERDE 'org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe' 
    WITH SERDEPROPERTIES (
        'odps.properties.rolearn'='acs:ram::<uid>:role/AliyunODPSDefaultRole'
    ) 
    STORED AS PARQUET 
    PROPERTIES('mcfed.parquet.compression'='SNAPPY');
  3. 驗證結果:登入OSS管理主控台,查看目標 OSS 路徑的匯入結果。匯出的檔案為 PARQUET 格式,並壓縮為 SNAPPY 格式。

樣本2:匯出分區資料為 PARQUET 格式

將 MaxCompute sale_detail 表分區為sale_date='2013'region='china'的資料匯出為 PARQUET 格式並壓縮為 SNAPPY。sale_detail的資料如下:

-- 分區欄位:sale_date、region
+------------+-------------+-------------+------------+------------+
| shop_name  | customer_id | total_price | sale_date  | region     |
+------------+-------------+-------------+------------+------------+
| s1         | c1          | 100.1       | 2013       | china      |
| s2         | c2          | 100.2       | 2013       | china      |
| s3         | c3          | 100.3       | 2013       | china      |
| null       | c5          | NULL        | 2014       | shanghai   |
| s6         | c6          | 100.4       | 2014       | shanghai   |
| s7         | c7          | 100.5       | 2014       | shanghai   |
+------------+-------------+-------------+------------+------------+

操作步驟

  1. OSS 側:登入OSS管理主控台,建立 OSS Bucket 目錄mc-unload/data_location/,地區為oss-cn-hangzhou,並構造 OSS 路徑。更多建立 OSS Bucket 資訊,請參見控制台建立儲存空間。根據 Bucket、地區、Endpoint 資訊構造 OSS 路徑如下:

    oss://oss-cn-hangzhou-internal.aliyuncs.com/mc-unload/data_location
  2. MaxCompute 側:登入 MaxCompute用戶端,執行 UNLOAD 命令。

    -- 設定單個 Worker 讀取 MaxCompute 表資料的大小為 256MB,用於控制匯出檔案個數。
    SET odps.stage.mapper.split.size=256;
    
    UNLOAD FROM sale_detail PARTITION (sale_date='2013',region='china') 
    INTO 
    LOCATION 'oss://oss-cn-hangzhou-internal.aliyuncs.com/mc-unload/data_location' 
    ROW FORMAT SERDE 'org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe' 
    WITH SERDEPROPERTIES ('odps.properties.rolearn'='acs:ram::<uid>:role/AliyunODPSDefaultRole') 
    STORED AS PARQUET 
    PROPERTIES('mcfed.parquet.compression'='SNAPPY');
  3. 驗證結果:登入OSS管理主控台,查看目標 OSS 路徑的匯入結果。匯出的檔案為 PARQUET 格式,並壓縮為 SNAPPY 格式。

樣本3:匯出 TEXTFILE 格式並指定分隔字元

sale_detail表中的資料匯出為 TXT 檔案並指定逗號為分隔字元。

-- 分區欄位:sale_date、region
+------------+-------------+-------------+------------+------------+
| shop_name  | customer_id | total_price | sale_date  | region     |
+------------+-------------+-------------+------------+------------+
| s1         | c1          | 100.1       | 2013       | china      |
| s2         | c2          | 100.2       | 2013       | china      |
| s3         | c3          | 100.3       | 2013       | china      |
| null       | c5          | NULL        | 2014       | shanghai   |
| s6         | c6          | 100.4       | 2014       | shanghai   |
| s7         | c7          | 100.5       | 2014       | shanghai   |
+------------+-------------+-------------+------------+------------+

操作步驟

  1. OSS 側:登入OSS管理主控台,建立 OSS Bucket 目錄mc-unload/data_location/,地區為oss-cn-hangzhou,並構造 OSS 路徑。更多建立 OSS Bucket 資訊,請參見控制台建立儲存空間。根據 Bucket、地區、Endpoint 資訊構造 OSS 路徑如下:

    oss://oss-cn-hangzhou-internal.aliyuncs.com/mc-unload/data_location
  2. MaxCompute 側:登入 MaxCompute用戶端,執行 UNLOAD 命令。

    -- 設定單個 Worker 讀取 MaxCompute 表資料的大小為 256MB,用於控制匯出檔案個數。
    SET odps.sql.allow.fullscan=true; 
    
    UNLOAD FROM (SELECT * FROM sale_detail)
    INTO
    LOCATION 'oss://oss-cn-beijing-internal.aliyuncs.com/mc-unload/data_location/'
    ROW FORMAT SERDE 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
    WITH SERDEPROPERTIES ('field.delim'=',')
    STORED AS TEXTFILE
    PROPERTIES ('odps.external.data.enable.extension'='true');
  3. 驗證結果:登入OSS管理主控台,查看目標 OSS 路徑的匯入結果。匯出的檔案為 TXT 格式,並以逗號分隔。

自訂檔案名稱前尾碼以及副檔名

UNLOAD 到 OSS 時,可以通過  PROPERTIES 或 SERDEPROPERTIES 中的屬性自訂輸出檔案的首碼、尾碼和副檔名。

文法

UNLOAD FROM {<select_statement>|<table_name> [PARTITION (<pt_spec>)]}
INTO 
LOCATION <oss_location>
[ROW FORMAT SERDE '<serde_class>' 
  [WITH SERDEPROPERTIES ('<property_name>'='<property_value>',...)]
]
STORED AS <file_format>
[PROPERTIES ('<tbproperty_name>'='<tbproperty_value>',...)];

核心配置

property_name/tbproperty_name

說明

樣本值

odps.external.data.output.prefix

檔案名稱首碼(字母、數字、底線,1-10個字元)。

'mc_'

odps.external.data.output.suffix

檔案名稱尾碼(字母、數字、底線)。

'_hangzhou'

odps.external.data.enable.extension

是否顯示預設副檔名(如 .tx、 .parquet)。

'true'

odps.external.data.output.explicit.extension

自訂副檔名,優先順序高於預設副檔名。

'jsonl'

尾碼參考

各外部表格通過參數odps.external.data.enable.extension=true自動產生的副檔名如下。

檔案格式

SerDe

尾碼

SEQUENCEFILE

org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe

.sequencefile

TEXTFILE

org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe

.txt

RCFILE

org.apache.hadoop.hive.serde2.columnar.LazyBinaryColumnarSerDe

.rcfile

ORC

org.apache.hadoop.hive.ql.io.orc.OrcSerde

.orc

PARQUET

org.apache.hadoop.hive.ql.io.parquet.serde.ParquetHiveSerDe

.parquet

AVRO

org.apache.hadoop.hive.serde2.avro.AvroSerDe

.avro

JSON

org.apache.hive.hcatalog.data.JsonSerDe

.json

CSV

org.apache.hadoop.hive.serde2.OpenCSVSerde

.csv

說明

以 SNAPPY 或 LZO 壓縮格式匯出資料時,匯出檔案不支援顯示.snappy 或.lzo 尾碼名。

使用樣本

樣本1:匯出 TEXTFILE 格式檔案,添加首碼和尾碼

將 MaxCompute 專案中表sale_detail的資料匯出 TXT 格式檔案至 OSS,並命名為 mc_<系統產生>_beijing.txt 的格式。sale_detail的資料如下:

-- 分區欄位:sale_date、region
+------------+-------------+-------------+------------+------------+
| shop_name  | customer_id | total_price | sale_date  | region     |
+------------+-------------+-------------+------------+------------+
| s1         | c1          | 100.1       | 2013       | china      |
| s2         | c2          | 100.2       | 2013       | china      |
| s3         | c3          | 100.3       | 2013       | china      |
| null       | c5          | NULL        | 2014       | shanghai   |
| s6         | c6          | 100.4       | 2014       | shanghai   |
| s7         | c7          | 100.5       | 2014       | shanghai   |
+------------+-------------+-------------+------------+------------+

操作步驟

  1. OSS 側:登入OSS管理主控台,建立 OSS Bucket 目錄mc-unload/data_location/,地區為oss-cn-hangzhou,並構造 OSS 路徑。更多建立 OSS Bucket 資訊,請參見控制台建立儲存空間。根據 Bucket、地區、Endpoint 資訊構造 OSS 路徑如下:

    oss://oss-cn-hangzhou-internal.aliyuncs.com/mc-unload/data_location
  2. MaxCompute 側:登入 MaxCompute用戶端,執行 UNLOAD 命令。

    UNLOAD FROM (SELECT * FROM sale_detail) 
    INTO 
    LOCATION 'oss://oss-cn-beijing-internal.aliyuncs.com/***/textfile' 
    row format serde 'org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe'
    STORED AS textfile
    PROPERTIES (
        'odps.external.data.output.prefix'='mc_', 
        'odps.external.data.output.suffix'='_beijing',
        'odps.external.data.enable.extension'='true');
  3. 驗證結果:登入OSS管理主控台,查看目標 OSS 路徑的匯入結果。匯出的檔案名稱為 mc_<系統產生>_beijing.txt

樣本2:匯出 JSON 格式檔案,自訂副檔名

將 MaxCompute 專案中表sale_detail的資料匯出 JSON 格式檔案至 OSS,並命名為 mc_<系統產生的檔案名稱>_beijing.json 的格式。sale_detail的資料如下:

-- 分區欄位:sale_date、region
+------------+-------------+-------------+------------+------------+
| shop_name  | customer_id | total_price | sale_date  | region     |
+------------+-------------+-------------+------------+------------+
| s1         | c1          | 100.1       | 2013       | china      |
| s2         | c2          | 100.2       | 2013       | china      |
| s3         | c3          | 100.3       | 2013       | china      |
| null       | c5          | NULL        | 2014       | shanghai   |
| s6         | c6          | 100.4       | 2014       | shanghai   |
| s7         | c7          | 100.5       | 2014       | shanghai   |
+------------+-------------+-------------+------------+------------+

操作步驟

  1. OSS 側:登入OSS管理主控台,建立 OSS Bucket 目錄mc-unload/data_location/,地區為oss-cn-hangzhou,並構造 OSS 路徑。更多建立 OSS Bucket 資訊,請參見控制台建立儲存空間。根據 Bucket、地區、Endpoint 資訊構造 OSS 路徑如下:

    oss://oss-cn-hangzhou-internal.aliyuncs.com/mc-unload/data_location
  2. MaxCompute 側:登入 MaxCompute用戶端,執行 UNLOAD 命令。

    UNLOAD FROM (SELECT * FROM sale_detail) 
    INTO 
    LOCATION 'oss://oss-cn-beijing-internal.aliyuncs.com/***/json' 
    ROW FORMAT SERDE 'org.apache.hive.hcatalog.data.JsonSerDe'
    WITH SERDEPROPERTIES (
        'odps.external.data.output.prefix'='mc_', 
        'odps.external.data.output.suffix'='_beijing',
        'odps.external.data.output.explicit.extension'='json')
    STORED AS JSON;
  3. 驗證結果:登入OSS管理主控台,查看目標 OSS 路徑的匯入結果。匯出的檔案名稱為 mc_<系統產生的檔案名稱>_beijing.json

匯出至Hologres

使用限制

  • 不支援雙簽名:匯出至 Hologres 中,不支援使用雙簽名授權模式。

  • 不支援分區表:不支援將資料匯出至 Hologres 分區表。

  • 類型映射:Hologres 資料接收表的欄位類型需與 MaxCompute 表欄位類型對應,詳情請參見MaxCompute與Hologres的資料類型映射

文法

UNLOAD FROM {<select_statement>|<table_name> [PARTITION (<pt_spec>)]} 
INTO 
LOCATION <hologres_location>
STORED BY <StorageHandler>
[WITH SERDEPROPERTIES ('<property_name>'='<property_value>',...)];

核心配置

配置項

說明

hologres_location

目標 Hologres 表的 JDBC 連接字串。格式為'jdbc:postgresql://<endpoint>:<port>/<database>?ApplicationName=MaxCompute&[currentSchema=<schema>&][useSSL={true|false}&]table=<holo_table_name>/'

StorageHandler

指定內建處理器。固定取值為com.aliyun.odps.jdbc.JdbcStorageHandler,使用JdbcStorageHandler串連方式。

SERDEPROPERTIES

必須包含以下三個屬性:

  • 'odps.properties.rolearn'='<ram_arn>':訪問 Hologres 的 RAM 角色 ARN。

  • 'mcfed.mapreduce.jdbc.driver.class'='org.postgresql.Driver':Hologres 的 JDBC 驅動。

  • 'odps.federation.jdbc.target.db.type'='holo':目標資料庫類型。

使用樣本

將 MaxCompute表data_test匯出至Hologres表mc_2_holodata_test的資料如下:

+------------+------+
| id         | name |
+------------+------+
| 3          | rgege |
| 4          | Gegegegr |
+------------+------+

操作步驟

  1. Hologres 側:在 Hologres 中建立接收表mc_2_holo

    CREATE TABLE mc_2_holo (id INT, name TEXT);
  2. MaxCompute 側:登入MaxCompute用戶端,執行UNLOAD命令。

    UNLOAD FROM (SELECT * FROM data_test) 
    INTO 
    LOCATION 'jdbc:postgresql://hgprecn-cn-5y**********-cn-hangzhou-internal.hologres.aliyuncs.com:80/test?ApplicationName=MaxCompute&currentSchema=public&useSSL=false&table=mc_2_holo/'  
    STORED BY 'com.aliyun.odps.jdbc.JdbcStorageHandler'
    WITH SERDEPROPERTIES ( 
      'odps.properties.rolearn'='acs:ram::13**************:role/aliyunodpsholorole',
      'mcfed.mapreduce.jdbc.driver.class'='org.postgresql.Driver', 
      'odps.federation.jdbc.target.db.type'='holo'
    );
  3. 驗證結果:在Hologres中查看匯出的資料。

    SELECT * FROM mc_2_holo;

    返回結果:

    id	name
    4	Gegegegr
    3	rgege

計費說明

命令計費

  • UNLOAD 命令本身不計費:UNLOAD 命令本身不產生費用。

  • 查詢子句計費:UNLOAD 命令中的查詢子句需要掃描資料並使用計算資源計算結果,因此查詢子句按照普通 SQL 作業計費。

儲存計費

通過 OSS 儲存結構化資料在一些情境中可以節省儲存費用,但需要提前做好費用估算:

  • MaxCompute 儲存費用0.018 USD/GB/月,更多儲存計費資訊,請參見儲存費用(隨用隨付)。資料匯入MaxCompute後有5倍左右的壓縮率,計費依據的資料量是壓縮後的資料。

  • OSS 儲存費用:OSS儲存標準型單價為0.018 USD/GB/月,另有其他低頻訪問型、歸檔型、冷歸檔型儲存,請參見儲存費用

費用最佳化建議

如果匯出資料只是為了節省儲存費用,建議:

  1. 測試壓縮率:根據資料特徵測試估算壓縮率。

  2. 估算 UNLOAD 費用:根據匯出時的查詢語句估算 UNLOAD 費用。

  3. 評估訪問方式:評估後續對匯出資料的訪問方式,避免因不必要的資料移轉產生額外費用。

相關文檔

若希望將外部儲存上的 CSV 格式或其他開源格式資料匯入至 MaxCompute,請參見LOAD