SelectDB Enterprise
参考手册
SQL 语句
集群管理
存储资源管理
SHOW STORAGE POLICY

SHOW STORAGE POLICY

描述

查看所有/指定存储策略关联的表和分区。

语法

SHOW STORAGE POLICY [ USING [ FOR <storage_policy_name> ] ]

必选参数

<storage_policy_name>: 要查看的存储策略的名字。

权限控制

执行此 SQL 命令成功的前置条件是,拥有 ADMIN_PRIV 权限,参考权限文档。

权限(Privilege)对象(Object)说明(Notes)
ADMIN_PRIV整个集群管理权限除 NODE_PRIV 以外的所有权限

示例

  1. 查看所有启用了存储策略的对象。

    show storage policy using;
    +-----------------------+-----------------------------------------+----------------------------------------+------------+
    | PolicyName            | Database                                | Table                                  | Partitions |
    +-----------------------+-----------------------------------------+----------------------------------------+------------+
    | test_storage_policy   | regression_test_cold_heat_separation_p2 | table_with_storage_policy_1            | ALL        |
    | test_storage_policy   | regression_test_cold_heat_separation_p2 | partition_with_multiple_storage_policy | p201701    |
    | test_storage_policy_2 | regression_test_cold_heat_separation_p2 | partition_with_multiple_storage_policy | p201702    |
    | test_storage_policy_2 | regression_test_cold_heat_separation_p2 | table_with_storage_policy_2            | ALL        |
    | test_policy           | db2                                     | db2_test_1                             | ALL        |
    +-----------------------+-----------------------------------------+----------------------------------------+------------+
  2. 查看使用存储策略 test_storage_policy 的对象。

    show storage policy using for test_storage_policy;
    +---------------------+-----------+---------------------------------+------------+
    | PolicyName          | Database  | Table                           | Partitions |
    +---------------------+-----------+---------------------------------+------------+
    | test_storage_policy | db_1      | partition_with_storage_policy_1 | p201701    |
    | test_storage_policy | db_1      | table_with_storage_policy_1     | ALL        |
    +---------------------+-----------+---------------------------------+------------+
  3. 查看所有存储策略的属性。

    show storage policy;
    +-------------+----------+---------+---------+-----------------+------------------+-------------+
    | PolicyName  | Id       | Version | Type    | StorageResource | CooldownDatetime | CooldownTtl |
    +-------------+----------+---------+---------+-----------------+------------------+-------------+
    | test_policy | 14589252 | 0       | STORAGE | remote_s3       | -1               | 300         |
    | dev_policy  | 14589521 | 0       | STORAGE | remote_s3       | -1               | 3000        |
    +-------------+----------+---------+---------+-----------------+------------------+-------------+
© 2025 北京飞轮数据科技有限公司 京ICP备2022004029号 | Apache、Apache Doris 以及相关开源项目名称均为 Apache 基金会商标