Todos os produtos
Search
Central de documentação

MaxCompute:DESC TABLE/VIEW

Última atualização: Jun 26, 2026

Exibe informações sobre tabelas internas, views, views materializadas, tabelas externas, tabelas clusterizadas ou tabelas transacionais do MaxCompute.

Sintaxe

-- Basic: internal table or view, with optional partition filter
DESC <table_name | view_name> [PARTITION (<pt_spec>)];

-- Extended: materialized view, foreign table, clustered table, transactional table,
-- or extended information for an internal table
DESC EXTENDED <table_name | mv_name>;

Use DESC para obter uma visão geral rápida do esquema de uma tabela interna ou view. Adicione a palavra-chave EXTENDED para recuperar propriedades adicionais de armazenamento e cluster, ou para visualizar metadados por coluna, como nulabilidade e valores padrão.

Parâmetros

Parâmetro

Obrigatório

Descrição

table_name

Sim

Nome da tabela a inspecionar.

view_name

Sim

Nome da view a inspecionar.

mv_name

Nome da view materializada a inspecionar. Use com EXTENDED.

pt_spec

Não

Filtro de partição para tabelas particionadas. Formato: (partition_col1 = value1, partition_col2 = value2, ...).

EXTENDED

Retorna informações estendidas: nulabilidade e valores padrão por coluna para tabelas internas, além de propriedades de cluster, armazenamento e transação para outros tipos de tabela.

Valores de retorno

Campos padrão

Campo

Descrição

Owner

Conta do proprietário da tabela ou view.

Project

Projeto do MaxCompute ao qual a tabela ou view pertence.

TableComment

Comentário da tabela ou view.

CreateTime

Horário de criação da tabela ou view.

LastDDLTime

Data e hora da última modificação na Linguagem de Definição de Dados (DDL) da tabela ou view.

LastModifiedTime

Data e hora da última alteração nos dados da tabela ou view.

LastAccessTime

Horário aproximado do último acesso aos dados, com precisão de 24 horas. Se o acesso for frequente, esse valor não é atualizado mais de uma vez a cada 24 horas para reduzir a sobrecarga de desempenho.

Lifecycle

Ciclo de vida em dias. Retornado apenas quando há um ciclo de vida definido na tabela.

InternalTable

Indica se o objeto é uma tabela interna. Retornado somente para objetos de tabela.

VirtualView

Indica se o objeto é uma view. Retornado somente para objetos de view.

Size

Tamanho da tabela em bytes. Inclui dados presentes na lixeira.

NativeColumns

Definições das colunas da tabela ou view.

PartitionColumns

Definições das colunas de chave de partição. Retornado apenas para tabelas particionadas.

Campos estendidos (apenas DESC EXTENDED)

O comando DESC EXTENDED retorna campos adicionais conforme o tipo da tabela.

Views materializadas

Campo

Descrição

MaterializedView

Indica se o objeto é uma view materializada.

ViewText

Consulta SQL que define a view materializada.

Rewrite Enabled

Indica se a reescrita de consultas está ativada para a view materializada.

AutoRefresh Enabled

Indica se a atualização automática está ativada.

IsOutdated

Indica se os dados da view materializada estão desatualizados.

Tabelas clusterizadas

As propriedades de cluster aparecem na seção Extended Info:

Campo

Descrição

ClusterType

Tipo de cluster: hash ou range.

BucketNum

Número de buckets para tabelas com cluster hash.

ClusterColumns

Colunas usadas para clusterização.

SortColumns

Colunas usadas para ordenação dentro de cada bucket (apenas cluster hash).

Tabelas transacionais

Campo

Descrição

Transactional

Indica se a tabela é transacional.

IsolationMin

Nível mínimo de isolamento. Por exemplo, NONSTRICT_SNAPSHOT_ISOLATION.

Campos de armazenamento

Campo

Descrição

TableID

ID exclusivo da tabela.

IsArchived

Indica se a tabela está arquivada.

PhysicalSize

Tamanho físico de armazenamento em bytes.

FileNum

Quantidade de arquivos na tabela.

StoredAs

Formato de armazenamento, como AliOrc ou CFile.

CompressionStrategy

Estratégia de compressão aplicada à tabela.

odps.timemachine.retention.days

Número de dias de retenção de dados para viagem no tempo.

ColdStorageStatus

Status do armazenamento frio.

StorageTier

Camada de armazenamento, como Standard.

StorageTierLastModifiedTime

Data e hora da última modificação da camada de armazenamento.

encryption_enable

Indica se a criptografia está ativada.

Observações de uso

  • O campo Size na saída do DESC inclui dados atualmente na lixeira. Para obter o tamanho sem esses dados, execute primeiro PURGE TABLE <table_name> e depois DESC <table_name>.

  • Para inspecionar o conteúdo da lixeira do projeto atual, execute SHOW recyclebin.

  • Para verificar se uma tabela é transacional, use o cliente do MaxCompute versão 0.35.4 ou superior. Outras ferramentas não atualizadas para a versão necessária também podem omitir informações transacionais na saída.

Exemplos

Visualizar uma tabela não particionada

Crie uma tabela e inspecione-a:

CREATE TABLE test_table (
    key STRING
);

DESC test_table;

Saída:

+------------------------------------------------------------------------------------+
| Owner:                    ALIYUN$***_com                                           |
| Project:                  testproject                                              |
| TableComment:                                                                      |
+------------------------------------------------------------------------------------+
| CreateTime:               2025-12-15 15:04:49                                      |
| LastDDLTime:              2025-12-15 15:04:50                                      |
| LastModifiedTime:         2025-12-15 15:04:49                                      |
+------------------------------------------------------------------------------------+
| InternalTable: YES      | Size: 0                                                  |
+------------------------------------------------------------------------------------+
| Native Columns:                                                                    |
+------------------------------------------------------------------------------------+
| Field           | Type       | Label | Comment                                     |
+------------------------------------------------------------------------------------+
| key             | string     |       |                                             |
+------------------------------------------------------------------------------------+

Visualizar uma tabela particionada

CREATE TABLE test_table_partition (
    shop_name       STRING,
    customer_id     STRING,
    total_price     DOUBLE
)
PARTITIONED BY (
    sale_date       STRING,
    region          STRING
);

DESC test_table_partition;

Saída:

+------------------------------------------------------------------------------------+
| Owner:                    ALIYUN$***_com                                           |
| Project:                  testproject                                              |
| TableComment:                                                                      |
+------------------------------------------------------------------------------------+
| CreateTime:               2025-12-15 15:08:27                                      |
| LastDDLTime:              2025-12-15 15:08:27                                      |
| LastModifiedTime:         2025-12-15 15:08:27                                      |
+------------------------------------------------------------------------------------+
| InternalTable: YES      | Size: 0                                                  |
+------------------------------------------------------------------------------------+
| Native Columns:                                                                    |
+------------------------------------------------------------------------------------+
| Field           | Type       | Label | Comment                                     |
+------------------------------------------------------------------------------------+
| shop_name       | string     |       |                                             |
| customer_id     | string     |       |                                             |
| total_price     | double     |       |                                             |
+------------------------------------------------------------------------------------+
| Partition Columns:                                                                 |
+------------------------------------------------------------------------------------+
| sale_date       | string     |                                                     |
| region          | string     |                                                     |
+------------------------------------------------------------------------------------+

Visualizar informações estendidas de uma tabela particionada

O comando DESC EXTENDED adiciona nulabilidade e valores padrão por coluna, além da seção Extended Info com metadados de armazenamento:

CREATE TABLE IF NOT EXISTS test_table_partition (
    shop_name       STRING,
    customer_id     STRING,
    total_price     DOUBLE
)
PARTITIONED BY (
    sale_date       STRING,
    region          STRING
);

DESC EXTENDED test_table_partition;

Saída:

+------------------------------------------------------------------------------------+
| Owner:                    ALIYUN$***_com                                           |
| Project:                  testproject                                              |
| TableComment:                                                                      |
+------------------------------------------------------------------------------------+
| CreateTime:               2025-12-15 15:08:27                                      |
| LastDDLTime:              2025-12-15 15:08:27                                      |
| LastModifiedTime:         2025-12-15 15:08:27                                      |
+------------------------------------------------------------------------------------+
| InternalTable: YES      | Size: 0                                                  |
+------------------------------------------------------------------------------------+
| Native Columns:                                                                    |
+------------------------------------------------------------------------------------+
| Field    | Type   | Label | ExtendedLabel | Nullable | DefaultValue | Comment      |
+------------------------------------------------------------------------------------+
| shop_name | string |      |               | true     | NULL         |              |
| customer_id | string |    |               | true     | NULL         |              |
| total_price | double |    |               | true     | NULL         |              |
+------------------------------------------------------------------------------------+
| Partition Columns:                                                                 |
+------------------------------------------------------------------------------------+
| sale_date       | string     |                                                     |
| region          | string     |                                                     |
+------------------------------------------------------------------------------------+
| Extended Info:                                                                     |
+------------------------------------------------------------------------------------+
| TableID:                  8c4d6ed34c964326b45d0435a3babe45                         |
| IsArchived:               false                                                    |
| PhysicalSize:             0                                                        |
| FileNum:                  0                                                        |
| StoredAs:                 AliOrc                                                   |
| CompressionStrategy:      normal                                                   |
| odps.timemachine.retention.days: 1                                                        |
| encryption_enable:        false                                                    |
+------------------------------------------------------------------------------------+

Visualizar uma tabela com ciclo de vida

CREATE TABLE sale_detail_ctas(
    shop_name       STRING,
    customer_id     STRING,
    total_price     DOUBLE,
    sale_date       STRING,
    region          STRING
)
LIFECYCLE 10;

DESC EXTENDED sale_detail_ctas;

A saída inclui Lifecycle: 10 na seção de cabeçalho:

+------------------------------------------------------------------------------------+
| Owner:                    ALIYUN$***_com                                           |
| Project:                  testproject                                              |
| TableComment:                                                                      |
+------------------------------------------------------------------------------------+
| CreateTime:               2025-12-15 15:13:22                                      |
| LastDDLTime:              2025-12-15 15:13:22                                      |
| LastModifiedTime:         2025-12-15 15:13:22                                      |
| Lifecycle:                10                                                       |
+------------------------------------------------------------------------------------+
| InternalTable: YES      | Size: 0                                                  |
+------------------------------------------------------------------------------------+
| Native Columns:                                                                    |
+------------------------------------------------------------------------------------+
| Field    | Type   | Label | ExtendedLabel | Nullable | DefaultValue | Comment      |
+------------------------------------------------------------------------------------+
| shop_name | string |      |               | true     | NULL         |              |
| customer_id | string |    |               | true     | NULL         |              |
| total_price | double |    |               | true     | NULL         |              |
| sale_date | string |      |               | true     | NULL         |              |
| region   | string |       |               | true     | NULL         |              |
+------------------------------------------------------------------------------------+
| Extended Info:                                                                     |
+------------------------------------------------------------------------------------+
| TableID:                  8271334ac9724d09a4973b5b3d536f4c                         |
| IsArchived:               false                                                    |
| PhysicalSize:             0                                                        |
| FileNum:                  0                                                        |
| StoredAs:                 AliOrc                                                   |
| CompressionStrategy:      normal                                                   |
| odps.timemachine.retention.days: 1                                                 |
| ColdStorageStatus:        N/A                                                      |
| encryption_enable:        false                                                    |
| StorageTier:              Standard                                                 |
| StorageTierLastModifiedTime:  2025-12-15 15:13:22                                  |
+------------------------------------------------------------------------------------+

Visualizar uma tabela com tipos de dados complexos

CREATE TABLE test_newtype(
    c1              TINYINT,
    c2              SMALLINT,
    c3              INT,
    c4              BIGINT,
    c5              FLOAT,
    c6              DOUBLE,
    c7              DECIMAL,
    c8              BINARY,
    c9              TIMESTAMP,
    c10             ARRAY<MAP<BIGINT, BIGINT>>,
    c11             MAP<STRING, ARRAY<BIGINT>>,
    c12             STRUCT<s1:STRING, s2:BIGINT>,
    c13             VARCHAR(20)
);

DESC test_newtype;

Saída:

+------------------------------------------------------------------------------------+
| Owner:                    ALIYUN$***_com                                           |
| Project:                  testproject                                              |
| TableComment:                                                                      |
+------------------------------------------------------------------------------------+
| CreateTime:               2025-12-15 16:09:18                                      |
| LastDDLTime:              2025-12-15 16:09:18                                      |
| LastModifiedTime:         2025-12-15 16:09:18                                      |
+------------------------------------------------------------------------------------+
| InternalTable: YES      | Size: 0                                                  |
+------------------------------------------------------------------------------------+
| Native Columns:                                                                    |
+------------------------------------------------------------------------------------+
| Field           | Type       | Label | Comment                                     |
+------------------------------------------------------------------------------------+
| c1              | tinyint    |       |                                             |
| c2              | smallint   |       |                                             |
| c3              | int        |       |                                             |
| c4              | bigint     |       |                                             |
| c5              | float      |       |                                             |
| c6              | double     |       |                                             |
| c7              | decimal(38,18) |   |                                             |
| c8              | binary     |       |                                             |
| c9              | timestamp  |       |                                             |
| c10             | array<map<bigint,bigint>> |       |                              |
| c11             | map<string,array<bigint>> |       |                              |
| c12             | struct<s1:string,s2:bigint> |       |                            |
| c13             | varchar(20) |       |                                            |
+------------------------------------------------------------------------------------+

Visualizar uma tabela não particionada com cluster hash

As propriedades de cluster aparecem na seção Extended Info:

CREATE TABLE hash_clustered_nonpar (
    a               STRING,
    b               STRING,
    c               BIGINT
)
CLUSTERED BY (c)
SORTED BY (c ASC)
INTO 1024 BUCKETS;

DESC EXTENDED hash_clustered_nonpar;

Saída:

+------------------------------------------------------------------------------------+
| Owner:                    ALIYUN$***_com                                           |
| Project:                  testproject                                              |
| TableComment:                                                                      |
+------------------------------------------------------------------------------------+
| CreateTime:               2025-12-15 16:18:07                                      |
| LastDDLTime:              2025-12-15 16:18:07                                      |
| LastModifiedTime:         2025-12-15 16:18:07                                      |
+------------------------------------------------------------------------------------+
| InternalTable: YES      | Size: 0                                                  |
+------------------------------------------------------------------------------------+
| Native Columns:                                                                    |
+------------------------------------------------------------------------------------+
| Field    | Type   | Label | ExtendedLabel | Nullable | DefaultValue | Comment      |
+------------------------------------------------------------------------------------+
| a        | string |       |               | true     | NULL         |              |
| b        | string |       |               | true     | NULL         |              |
| c        | bigint |       |               | true     | NULL         |              |
+------------------------------------------------------------------------------------+
| Extended Info:                                                                     |
+------------------------------------------------------------------------------------+
| TableID:                  904e6a0d76624346903d59a2b536d0a3                         |
| IsArchived:               false                                                    |
| PhysicalSize:             0                                                        |
| FileNum:                  0                                                        |
| StoredAs:                 AliOrc                                                   |
| CompressionStrategy:      normal                                                   |
| odps.timemachine.retention.days: 1                                                 |
| ColdStorageStatus:        N/A                                                      |
| encryption_enable:        false                                                    |
| ClusterType:              hash                                                     |
| BucketNum:                1024                                                     |
| ClusterColumns:           [c]                                                      |
| SortColumns:              [c ASC]                                                  |
| StorageTier:              Standard                                                 |
| StorageTierLastModifiedTime:  2025-12-15 16:18:07                                  |
+------------------------------------------------------------------------------------+

Visualizar uma tabela particionada com cluster hash

CREATE TABLE hash_clustered_par (
    a               STRING,
    b               STRING,
    c               BIGINT
)
PARTITIONED BY (
    dt              STRING
)
CLUSTERED BY (c)
SORTED BY (c ASC)
INTO 1024 BUCKETS
LIFECYCLE 2;

DESC EXTENDED hash_clustered_par;

Saída:

+------------------------------------------------------------------------------------+
| Owner:                    ALIYUN$***_com                                           |
| Project:                  testproject                                              |
| TableComment:                                                                      |
+------------------------------------------------------------------------------------+
| CreateTime:               2025-12-15 16:26:24                                      |
| LastDDLTime:              2025-12-15 16:26:24                                      |
| LastModifiedTime:         2025-12-15 16:26:24                                      |
| Lifecycle:                2                                                        |
+------------------------------------------------------------------------------------+
| InternalTable: YES      | Size: 0                                                  |
+------------------------------------------------------------------------------------+
| Native Columns:                                                                    |
+------------------------------------------------------------------------------------+
| Field    | Type   | Label | ExtendedLabel | Nullable | DefaultValue | Comment      |
+------------------------------------------------------------------------------------+
| a        | string |       |               | true     | NULL         |              |
| b        | string |       |               | true     | NULL         |              |
| c        | bigint |       |               | true     | NULL         |              |
+------------------------------------------------------------------------------------+
| Partition Columns:                                                                 |
+------------------------------------------------------------------------------------+
| dt              | string     |                                                     |
+------------------------------------------------------------------------------------+
| Extended Info:                                                                     |
+------------------------------------------------------------------------------------+
| TableID:                  5680f0711add43928389db3655d9183e                         |
| IsArchived:               false                                                    |
| PhysicalSize:             0                                                        |
| FileNum:                  0                                                        |
| StoredAs:                 AliOrc                                                   |
| CompressionStrategy:      normal                                                   |
| odps.timemachine.retention.days: 1                                                 |
| encryption_enable:        false                                                    |
| ClusterType:              hash                                                     |
| BucketNum:                1024                                                     |
| ClusterColumns:           [c]                                                      |
| SortColumns:              [c ASC]                                                  |
+------------------------------------------------------------------------------------+

Visualizar uma tabela não particionada com cluster range

CREATE TABLE range_clustered_nonpar (
    a               STRING,
    b               STRING,
    c               BIGINT
)
RANGE CLUSTERED BY (c);

DESC EXTENDED range_clustered_nonpar;

Saída:

+------------------------------------------------------------------------------------+
| Owner:                    ALIYUN$***_com                                           |
| Project:                  testproject                                              |
| TableComment:                                                                      |
+------------------------------------------------------------------------------------+
| CreateTime:               2025-12-15 16:30:45                                      |
| LastDDLTime:              2025-12-15 16:30:45                                      |
| LastModifiedTime:         2025-12-15 16:30:45                                      |
+------------------------------------------------------------------------------------+
| InternalTable: YES      | Size: 0                                                  |
+------------------------------------------------------------------------------------+
| Native Columns:                                                                    |
+------------------------------------------------------------------------------------+
| Field    | Type   | Label | ExtendedLabel | Nullable | DefaultValue | Comment      |
+------------------------------------------------------------------------------------+
| a        | string |       |               | true     | NULL         |              |
| b        | string |       |               | true     | NULL         |              |
| c        | bigint |       |               | true     | NULL         |              |
+------------------------------------------------------------------------------------+
| Extended Info:                                                                     |
+------------------------------------------------------------------------------------+
| TableID:                  bf01d946c4b24c0e9c54ccfe8750b7c2                         |
| IsArchived:               false                                                    |
| PhysicalSize:             0                                                        |
| FileNum:                  0                                                        |
| StoredAs:                 AliOrc                                                   |
| CompressionStrategy:      normal                                                   |
| odps.timemachine.retention.days: 1                                                 |
| ColdStorageStatus:        N/A                                                      |
| encryption_enable:        false                                                    |
| ClusterType:              range                                                    |
| BucketNum:                0                                                        |
| ClusterColumns:           [c]                                                      |
| StorageTier:              Standard                                                 |
| StorageTierLastModifiedTime:  2025-12-15 16:30:45                                  |
+------------------------------------------------------------------------------------+

Visualizar uma tabela particionada com cluster range

CREATE TABLE range_clustered_par (
    a               STRING,
    b               STRING,
    c               BIGINT
)
PARTITIONED BY (
    dt              STRING
)
RANGE CLUSTERED BY (c);

DESC EXTENDED range_clustered_par;

Saída:

+------------------------------------------------------------------------------------+
| Owner:                    ALIYUN$***_com                                           |
| Project:                  testproject                                              |
| TableComment:                                                                      |
+------------------------------------------------------------------------------------+
| CreateTime:               2025-12-15 16:33:09                                      |
| LastDDLTime:              2025-12-15 16:33:09                                      |
| LastModifiedTime:         2025-12-15 16:33:09                                      |
+------------------------------------------------------------------------------------+
| InternalTable: YES      | Size: 0                                                  |
+------------------------------------------------------------------------------------+
| Native Columns:                                                                    |
+------------------------------------------------------------------------------------+
| Field    | Type   | Label | ExtendedLabel | Nullable | DefaultValue | Comment      |
+------------------------------------------------------------------------------------+
| a        | string |       |               | true     | NULL         |              |
| b        | string |       |               | true     | NULL         |              |
| c        | bigint |       |               | true     | NULL         |              |
+------------------------------------------------------------------------------------+
| Partition Columns:                                                                 |
+------------------------------------------------------------------------------------+
| dt              | string     |                                                     |
+------------------------------------------------------------------------------------+
| Extended Info:                                                                     |
+------------------------------------------------------------------------------------+
| TableID:                  bdc4f6897691479ea9c315664f26fe39                         |
| IsArchived:               false                                                    |
| PhysicalSize:             0                                                        |
| FileNum:                  0                                                        |
| StoredAs:                 AliOrc                                                   |
| CompressionStrategy:      normal                                                   |
| odps.timemachine.retention.days: 1                                                 |
| encryption_enable:        false                                                    |
| ClusterType:              range                                                    |
| BucketNum:                0                                                        |
| ClusterColumns:           [c]                                                      |
+------------------------------------------------------------------------------------+

Verificar se uma tabela não particionada é transacional

Use o cliente do MaxCompute versão 0.35.4 ou superior. Outras ferramentas não atualizadas para a versão necessária também podem omitir informações transacionais na saída.
CREATE TABLE tran_nonpar (
    id              BIGINT
)
TBLPROPERTIES ('transactional'='true');

DESC EXTENDED tran_nonpar;

A propriedade Transactional aparece na seção Extended Info:

+------------------------------------------------------------------------------------+
| Owner:                    ALIYUN$***_com                                           |
| Project:                  testproject                                              |
| TableComment:                                                                      |
+------------------------------------------------------------------------------------+
| CreateTime:               2025-12-15 16:37:27                                      |
| LastDDLTime:              2025-12-15 16:37:27                                      |
| LastModifiedTime:         2025-12-15 16:37:27                                      |
+------------------------------------------------------------------------------------+
| InternalTable: YES      | Size: 0                                                  |
+------------------------------------------------------------------------------------+
| Native Columns:                                                                    |
+------------------------------------------------------------------------------------+
| Field    | Type   | Label | ExtendedLabel | Nullable | DefaultValue | Comment      |
+------------------------------------------------------------------------------------+
| id       | bigint |       |               | true     | NULL         |              |
+------------------------------------------------------------------------------------+
| Extended Info:                                                                     |
+------------------------------------------------------------------------------------+
| TableID:                  43e9710c2b4c404780a7be9998afb23e                         |
| IsArchived:               false                                                    |
| PhysicalSize:             0                                                        |
| FileNum:                  0                                                        |
| StoredAs:                 AliOrc                                                   |
| CompressionStrategy:      normal                                                   |
| Transactional:            true                                                     |
| IsolationMin:             NONSTRICT_SNAPSHOT_ISOLATION                             |
| odps.timemachine.retention.days: 1                                                 |
| ColdStorageStatus:        N/A                                                      |
| encryption_enable:        false                                                    |
| StorageTier:              Standard                                                 |
| StorageTierLastModifiedTime:  2025-12-15 16:37:27                                  |
+------------------------------------------------------------------------------------+

Verificar se uma tabela particionada é transacional

Use o cliente do MaxCompute versão 0.35.4 ou superior. Outras ferramentas não atualizadas para a versão necessária também podem omitir informações transacionais na saída.
CREATE TABLE tran_par (
    id              BIGINT
)
PARTITIONED BY (
    ds              STRING
)
TBLPROPERTIES ('transactional'='true');

DESC EXTENDED tran_par;

A propriedade Transactional aparece na seção Extended Info:

+------------------------------------------------------------------------------------+
| Owner:                    ALIYUN$***_com                                           |
| Project:                  testproject                                              |
| TableComment:                                                                      |
+------------------------------------------------------------------------------------+
| CreateTime:               2025-12-15 16:42:26                                      |
| LastDDLTime:              2025-12-15 16:42:26                                      |
| LastModifiedTime:         2025-12-15 16:42:26                                      |
+------------------------------------------------------------------------------------+
| InternalTable: YES      | Size: 0                                                  |
+------------------------------------------------------------------------------------+
| Native Columns:                                                                    |
+------------------------------------------------------------------------------------+
| Field    | Type   | Label | ExtendedLabel | Nullable | DefaultValue | Comment      |
+------------------------------------------------------------------------------------+
| id       | bigint |       |               | true     | NULL         |              |
+------------------------------------------------------------------------------------+
| Partition Columns:                                                                 |
+------------------------------------------------------------------------------------+
| ds              | string     |                                                     |
+------------------------------------------------------------------------------------+
| Extended Info:                                                                     |
+------------------------------------------------------------------------------------+
| TableID:                  d4dd59b15f7940bcad4cb5efdb42f242                         |
| IsArchived:               false                                                    |
| PhysicalSize:             0                                                        |
| FileNum:                  0                                                        |
| StoredAs:                 AliOrc                                                   |
| CompressionStrategy:      normal                                                   |
| Transactional:            true                                                     |
| IsolationMin:             NONSTRICT_SNAPSHOT_ISOLATION                             |
| odps.timemachine.retention.days: 1                                                 |
| encryption_enable:        false                                                    |
+------------------------------------------------------------------------------------+

Visualizar uma view materializada

-- Create a base table.
CREATE TABLE page_view_logs (
    page_id STRING,
    user_id STRING,
    view_timestamp BIGINT
);

-- Create a materialized view that aggregates page views per page.
CREATE MATERIALIZED VIEW mv AS
SELECT
    page_id,
    COUNT(1) AS pv_count
FROM
    page_view_logs
GROUP BY
    page_id;

DESC EXTENDED mv;

Saída:

+------------------------------------------------------------------------------------+
| Owner:                    ALIYUN$***_com                                           |
| Project:                  testproject                                              |
| TableComment:                                                                      |
+------------------------------------------------------------------------------------+
| CreateTime:               2025-12-15 16:47:51                                      |
| LastDDLTime:              2025-12-15 16:47:51                                      |
| LastModifiedTime:         2025-12-15 16:47:51                                      |
+------------------------------------------------------------------------------------+
| MaterializedView: YES                                                              |
| ViewText: SELECT
    page_id,
    COUNT(1) AS pv_count
FROM
    page_view_logs
GROUP BY
    page_id |
| Rewrite Enabled: true                                                              |
| AutoRefresh Enabled: false                                                         |
+------------------------------------------------------------------------------------+
| Native Columns:                                                                    |
+------------------------------------------------------------------------------------+
| Field    | Type   | Label | ExtendedLabel | Nullable | DefaultValue | Comment      |
+------------------------------------------------------------------------------------+
| page_id  | string |       |               | true     | NULL         |              |
| pv_count | bigint |       |               | true     | NULL         |              |
+------------------------------------------------------------------------------------+
| Extended Info:                                                                     |
+------------------------------------------------------------------------------------+
| IsOutdated:               false                                                    |
| TableID:                  a8742f3751904ec3ade23a7ecc2a2b0b                         |
| IsArchived:               false                                                    |
| PhysicalSize:             0                                                        |
| FileNum:                  0                                                        |
| StoredAs:                 CFile                                                    |
| CompressionStrategy:      normal                                                   |
| odps.timemachine.retention.days: 1                                                        |
| ColdStorageStatus:        N/A                                                      |
| encryption_enable:        false                                                    |
| StorageTier:              Standard                                                 |
| StorageTierLastModifiedTime:  2025-12-15 16:47:51                                  |
+------------------------------------------------------------------------------------+

Consultar informações de partição

-- Create a partitioned table.
CREATE TABLE IF NOT EXISTS test_table_partition (
    shop_name       STRING,
    customer_id     STRING,
    total_price     DOUBLE
)
PARTITIONED BY (
    sale_date       STRING,
    region          STRING
);

-- Add a partition and insert data.
ALTER TABLE test_table_partition ADD IF NOT EXISTS
  PARTITION (sale_date='201310', region='beijing');

INSERT INTO TABLE test_table_partition PARTITION (sale_date='201310', region='beijing')
VALUES
    ('Apple Store', 'user001', 8888.0),
    ('Nike Store', 'user002', 1200.5),
    ('Starbucks', 'user001', 45.0);

-- Query the partition.
DESC test_table_partition PARTITION (sale_date='201310', region='beijing');

Saída:

+------------------------------------------------------------------------------------+
| PartitionSize: 1163                                                                |
+------------------------------------------------------------------------------------+
| CreateTime:               2025-12-15 16:54:16                                      |
| LastDDLTime:              2025-12-15 16:54:16                                      |
| LastModifiedTime:         2025-12-15 16:54:23                                      |
+------------------------------------------------------------------------------------+

Comandos relacionados