全部产品
Search
文档中心

MaxCompute:DESC TABLE/VIEW

更新时间:Dec 16, 2025

Menampilkan informasi tentang tabel internal MaxCompute, tampilan, tampilan materialisasi, tabel eksternal, tabel terkluster, atau tabel transaksional.

Sintaksis

-- Menampilkan informasi tentang tabel internal atau tampilan.
DESC <table_name|view_name> [PARTITION (<pt_spec>)]; 
-- Menampilkan informasi tentang tampilan yang di-materialisasi, tabel eksternal, tabel terkluster, atau tabel transaksional. Anda juga dapat melihat informasi tambahan tentang tabel internal.
DESC extended <table_name|mv_name>; 

Parameter

  • table_name: Wajib. Nama tabel yang akan dilihat.

  • view_name: Wajib. Nama tampilan yang akan dilihat.

  • mv_name: Nama tampilan materialisasi yang akan dikueri.

  • pt_spec: Opsional. Partisi spesifik dari tabel partisi yang akan dilihat. Formatnya adalah (partition_col1 = partition_col_value1, partition_col2 = partition_col_value2, ...).

  • extended: Sertakan parameter ini untuk menampilkan informasi tambahan mengenai tampilan materialisasi, tabel eksternal, tabel terkluster, atau tabel transaksional. Untuk tabel internal, parameter ini juga dapat digunakan untuk melihat informasi tambahan, seperti properti non-null suatu kolom.

Nilai Pengembalian

  • Owner: Akun yang memiliki tabel atau tampilan tersebut.

  • Project: Proyek tempat tabel atau tampilan tersebut berada.

  • TableComment: Komentar untuk tabel atau tampilan tersebut.

  • CreateTime: Waktu pembuatan tabel atau tampilan.

  • LastDDLTime: Waktu terakhir tabel atau tampilan dimodifikasi menggunakan pernyataan DDL.

  • LastModifiedTime: Waktu terakhir data dalam tabel atau tampilan dimodifikasi.

  • LastAccessTime: Waktu terakhir data dalam tabel atau tampilan diakses. Waktu ini bersifat referensi dan mungkin berbeda hingga 24 jam dari waktu akses aktual.

    Untuk mengurangi beban kinerja, LastAccessTime tidak diperbarui jika telah direfresh dalam 24 jam terakhir.
  • Lifecycle: Siklus hidup dalam satuan hari.

  • InternalTable: Menunjukkan apakah objek tersebut merupakan tabel internal. Parameter ini hanya dikembalikan untuk objek tabel.

  • VirtualView: Menunjukkan apakah objek tersebut merupakan tampilan. Parameter ini hanya dikembalikan untuk objek tampilan.

  • Size: Ukuran tabel dalam byte.

  • NativeColumns: Informasi kolom tabel atau tampilan.

  • PartitionColumns: Informasi mengenai kolom kunci partisi. Parameter ini hanya dikembalikan untuk tabel partisi.

Contoh

Catatan
  • Ukuran (Size) yang dikembalikan oleh DESC table_name mencakup ukuran data di keranjang daur ulang.

  • Untuk mengosongkan keranjang daur ulang, jalankan PURGE TABLE table_name, lalu jalankan DESC table_name. Ukuran yang dikembalikan tidak akan mencakup data di keranjang daur ulang.

  • Jalankan SHOW recyclebin untuk melihat detail data di keranjang daur ulang untuk proyek saat ini.

Contoh 1: Melihat informasi tentang tabel non-partisi

  • Buat tabel uji

    CREATE TABLE test_table (
        key STRING
    );
  • Lihat informasi tentang tabel test_table

    DESC test_table;
  • Hasil

    +------------------------------------------------------------------------------------+
    | 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     |       |                                             |
    +------------------------------------------------------------------------------------+

Contoh 2: Melihat informasi tentang tabel partisi

  • Buat tabel uji

    CREATE TABLE test_table_partition (
        shop_name       STRING,
        customer_id     STRING,
        total_price     DOUBLE
    )
    PARTITIONED BY (
        sale_date       STRING,
        region          STRING
    );
  • Lihat informasi tentang tabel tersebut

    DESC test_table_partition;
  • Hasil

    +------------------------------------------------------------------------------------+
    | 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     |                                                     |
    +------------------------------------------------------------------------------------+
    

Contoh 3: Melihat informasi detail tentang tabel partisi

  • Buat tabel uji

    CREATE TABLE IF NOT EXISTS test_table_partition (
        shop_name       STRING,
        customer_id     STRING,
        total_price     DOUBLE
    )
    PARTITIONED BY (
        sale_date       STRING,
        region          STRING
    );
  • Lihat informasi tentang tabel tersebut

    DESC EXTENDED test_table_partition;
  • Nilai yang dikembalikan

    +------------------------------------------------------------------------------------+
    | 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                                                    |
    +------------------------------------------------------------------------------------+
    

Contoh 4: Melihat informasi detail tentang tabel dengan lifecycle

  • Buat tabel uji

    CREATE TABLE sale_detail_ctas(
        shop_name       STRING,
        customer_id     STRING,
        total_price     DOUBLE,
        sale_date       STRING,
        region          STRING
    )
    LIFECYCLE 10;
  • Lihat informasi detail tentang tabel tersebut

    DESC EXTENDED sale_detail_ctas;
  • Hasil

    +------------------------------------------------------------------------------------+
    | 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                                  |
    +------------------------------------------------------------------------------------+

Contoh 5: Melihat informasi tentang tabel yang berisi bidang dengan tipe data berbeda

  • Buat tabel uji

    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)
    );
  • Lihat informasi detail tentang tabel tersebut

    DESC test_newtype;
  • Hasil

    +------------------------------------------------------------------------------------+
    | 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) |       |                                            |
    +------------------------------------------------------------------------------------+

Contoh 6: Melihat informasi tentang tabel non-partisi yang dikluster berdasarkan hash

  • Buat tabel uji

    CREATE TABLE hash_clustered_nonpar (
        a               STRING,
        b               STRING,
        c               BIGINT
    )
    CLUSTERED BY (c)
    SORTED BY (c ASC)
    INTO 1024 BUCKETS;
    
  • Lihat informasi detail tentang tabel tersebut

    DESC EXTENDED hash_clustered_nonpar;
  • Hasil

    Properti pengelompokan ditampilkan di bagian Extended Info.

    +------------------------------------------------------------------------------------+
    | 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                                  |
    +------------------------------------------------------------------------------------+

Contoh 7: Melihat informasi tentang tabel partisi yang dikluster berdasarkan hash

  • Buat tabel uji

    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;
    
  • Lihat informasi detail tentang tabel tersebut

    DESC EXTENDED hash_clustered_par;
  • Hasil

    Properti pengelompokan ditampilkan di bagian Extended Info.

    +------------------------------------------------------------------------------------+
    | 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]                                                  |
    +------------------------------------------------------------------------------------+

Contoh 8: Melihat informasi tentang tabel non-partisi yang dikluster berdasarkan rentang

  • Buat tabel uji

    CREATE TABLE range_clustered_nonpar (
        a               STRING,
        b               STRING,
        c               BIGINT
    )
    RANGE CLUSTERED BY (c);
  • Lihat informasi detail tentang tabel tersebut

    DESC EXTENDED range_clustered_nonpar;
  • Hasil

    Properti pengelompokan ditampilkan di bagian Extended Info.

    +------------------------------------------------------------------------------------+
    | 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                                  |
    +------------------------------------------------------------------------------------+

Contoh 9: Melihat informasi tentang tabel partisi yang dikluster berdasarkan rentang

  • Buat tabel uji

    CREATE TABLE range_clustered_par (
        a               STRING,
        b               STRING,
        c               BIGINT
    )
    PARTITIONED BY (
        dt              STRING
    )
    RANGE CLUSTERED BY (c);
  • Lihat informasi detail tentang tabel tersebut

    DESC EXTENDED range_clustered_par;
  • Hasil

    Properti pengelompokan ditampilkan di bagian Extended Info.

    +------------------------------------------------------------------------------------+
    | 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]                                                      |
    +------------------------------------------------------------------------------------+

Contoh 10: Memeriksa apakah tabel non-partisi merupakan tabel transaksional

Catatan

Gunakan MaxCompute client (versi 0.35.4 atau lebih baru) untuk memeriksa apakah suatu tabel merupakan tabel transaksional.

Alat lain mungkin belum diperbarui dan mungkin tidak menampilkan informasi transaksional dalam hasil kueri.

  • Buat tabel uji

    CREATE TABLE tran_nonpar (
        id              BIGINT
    )
    TBLPROPERTIES ('transactional'='true');
  • Lihat informasi detail tentang tabel tersebut

    DESC EXTENDED tran_nonpar;
  • Hasil

    Properti Transactional ditampilkan di bagian 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                                  |
    +------------------------------------------------------------------------------------+

Contoh 11: Memeriksa apakah tabel partisi merupakan tabel transaksional

Catatan

Gunakan MaxCompute client (versi 0.35.4 atau lebih baru) untuk memeriksa apakah suatu tabel merupakan tabel transaksional.

Alat lain mungkin belum diperbarui dan mungkin tidak menampilkan informasi transaksional dalam hasil kueri.

  • Buat tabel uji

    CREATE TABLE tran_par (
        id              BIGINT
    )
    PARTITIONED BY (
        ds              STRING
    )
    TBLPROPERTIES ('transactional'='true');
  • Lihat informasi detail tentang tabel tersebut

    DESC EXTENDED tran_par;
  • Hasil

    Properti Transactional ditampilkan di bagian 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                                                    |
    +------------------------------------------------------------------------------------+

Contoh 12: Mengkueri informasi tentang tampilan yang di-materialisasi mv

  • Buat tabel uji

    -- Buat tabel dasar untuk pengujian.
    CREATE TABLE page_view_logs (
        page_id STRING,
        user_id STRING,
        view_timestamp BIGINT
    );
    
    -- Buat tampilan yang di-materialisasi untuk menghitung jumlah tayangan halaman (PV) untuk setiap halaman.
    CREATE MATERIALIZED VIEW mv AS
    SELECT
        page_id,
        COUNT(1) AS pv_count
    FROM
        page_view_logs
    GROUP BY
        page_id;
  • Lihat informasi detail tentang tampilan materialisasi tersebut

    DESC EXTENDED mv;
  • Hasil

    +------------------------------------------------------------------------------------+
    | 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                                  |
    +------------------------------------------------------------------------------------+
    

Contoh 14: Mengkueri informasi partisi dari tabel partisi

  • Buat tabel uji

    -- Buat tabel uji.
    CREATE TABLE IF NOT EXISTS test_table_partition (
        shop_name       STRING,
        customer_id     STRING,
        total_price     DOUBLE
    )
    PARTITIONED BY (
        sale_date       STRING,
        region          STRING
    );
    
    -- Buat partisi.
    ALTER TABLE test_table_partition ADD IF NOT EXISTS 
      PARTITION (sale_date='201310', region='beijing');
      
    -- Gunakan INSERT INTO untuk menambahkan data ke partisi tertentu.
    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);
  • Kueri informasi partisi dari tabel partisi tersebut.

    DESC test_table_partition PARTITION (sale_date='201310', region='beijing');
  • Hasil

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

Pernyataan Terkait

  • CREATE TABLE: Membuat tabel non-partisi, tabel partisi, tabel eksternal, atau tabel terkluster.

  • CREATE VIEW: Membuat tampilan atau memperbarui tampilan yang sudah ada berdasarkan pernyataan kueri.

  • CREATE MATERIALIZED VIEW: Membuat tampilan materialisasi untuk skenario yang didukung. Partisi dan pengelompokan juga didukung.

  • ALTER MATERIALIZED VIEW: Memperbarui tampilan materialisasi dengan mengubah siklus hidupnya, mengaktifkan atau menonaktifkan siklus hidupnya, atau menghapus partisinya.

  • SELECT MATERIALIZED VIEW: Mengkueri status tampilan materialisasi.

  • DROP MATERIALIZED VIEW: Menghapus tampilan materialisasi.