Files
doc-exports/docs/dli/sqlreference/dli_08_0094.html
Su, Xiaomeng be9eabe464 dli_sqlreference_20250305
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
2025-03-25 09:06:21 +00:00

7.7 KiB

Checking All Partitions in a Specified Table

Function

This statement is used to check all partitions in a specified table.

Syntax

1
2
SHOW PARTITIONS [db_name.]table_name
  [PARTITION partition_specs];

Keywords

  • PARTITIONS: partitions in a specified table
  • PARTITION: a specified partition

Parameters

Table 1 Parameters

Parameter

Description

db_name

Database name that contains letters, digits, and underscores (_). It cannot contain only digits and cannot start with an underscore (_).

table_name

Table name of a database that contains letters, digits, and underscores (_). The name cannot contain only digits or start with an underscore (_).

The matching rule is ^(?!_)(?![0-9]+$)[A-Za-z0-9_$]*$. If special characters are required, use single quotation marks ('') to enclose them.

partition_specs

Partition information, in the format of "key=value", where key indicates the partition field and value indicates the partition value. If a partition field contains multiple fields, the system displays all partition information that matches the partition field.

Precautions

The table specified in this statement must exist and must be a partitioned table. Otherwise, an error is reported.

Example

  • To show all partitions in the student table, run the following statement:
    1
    SHOW PARTITIONS student;
    
  • Check the dt='2010-10-10' partition in the student table, run the following statement:
    1
    SHOW PARTITIONS student PARTITION(dt='2010-10-10');