PostgreSQL 创建分区表查询表的所有分区

Posted 欢迎访问楚原的博客

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PostgreSQL 创建分区表查询表的所有分区相关的知识,希望对你有一定的参考价值。

DROP TABLE IF EXISTS "npas"."pl_rt_wfm_1h";
CREATE TABLE "npas"."pl_rt_wfm_1h" (
  "新系统规划站点编码" varchar(128) COLLATE "pg_catalog"."default",
  "规划入网方案编码" varchar(128) COLLATE "pg_catalog"."default",
  "规划入网批次编码" varchar(128) COLLATE "pg_catalog"."default",
  "流程名称" varchar(255) COLLATE "pg_catalog"."default",
  "流程开始时间" timestamp(6),
  "流程内环节" varchar(128) COLLATE "pg_catalog"."default",
  "bbunum" int8,
  "方案经度" float8,
  "方案纬度" float8,
  "单优不通过原因" varchar(4000) COLLATE "pg_catalog"."default",
  "单优是否通过" varchar(128) COLLATE "pg_catalog"."default",
  "工程退单类型" varchar(128) COLLATE "pg_catalog"."default",
  "单优实测经度" text COLLATE "pg_catalog"."default",
  "单优实测纬度" text COLLATE "pg_catalog"."default",
  "工程自检时间" timestamp(6),
  "单优申请时间" timestamp(6),
  "方案设计办结时间" timestamp(6),
  "工程施工办结时间" timestamp(6),
  "集中开站办结时间" timestamp(6),
  "工程自检办结时间" timestamp(6),
  "单优激活办结时间" timestamp(6),
  "单优结果填报开始时间" timestamp(6),
  "单优结果填报结束时间" timestamp(6),
  "验收交维办结时间" timestamp(6),
  "验收交维发起时间" timestamp(6),
  "有勘察报告" varchar(128) COLLATE "pg_catalog"."default",
  "有设计方案" varchar(128) COLLATE "pg_catalog"."default",
  "市无优审核人" varchar(128) COLLATE "pg_catalog"."default",
  "市无优审核时间" timestamp(6),
  "市无优审核结果" varchar(4000) COLLATE "pg_catalog"."default",
  "市无优审核情况" varchar(4000) COLLATE "pg_catalog"."default",
  "省1+N审核人" varchar(32) COLLATE "pg_catalog"."default",
  "省1+N审核时间" varchar(32) COLLATE "pg_catalog"."default",
  "省1+N审核结果" varchar(4000) COLLATE "pg_catalog"."default",
  "省1+N审核情况" varchar(4000) COLLATE "pg_catalog"."default",
  "资源数据审核人" varchar(32) COLLATE "pg_catalog"."default",
  "资源数据审核时间" varchar(32) COLLATE "pg_catalog"."default",
  "资源数据审核结果" varchar(4000) COLLATE "pg_catalog"."default",
  "集中开站开始时间" varchar(32) COLLATE "pg_catalog"."default",
  "优化报告" varchar(32) COLLATE "pg_catalog"."default",
  "验收数据" varchar(32) COLLATE "pg_catalog"."default",
  "集中开站数据规划及导入环节的处理人" varchar(64) COLLATE "pg_catalog"."default",
  "集中开站数据规划及导入环节的处理时间" timestamp(6),
  "单优激活发起时间" timestamp(6),
  "report_time" timestamp(6)
) PARTITION BY RANGE(report_time)
;
COMMENT ON TABLE "npas"."pl_rt_wfm_1h" IS \'规划库报表\';

 

 

select
    c.relname
from
    pg_class c
    join pg_inherits i on i.inhrelid = c. oid
    join pg_class d on d.oid = i.inhparent
where
    d.relname = \'pl_rt_wfm_1h\';

 

以上是关于PostgreSQL 创建分区表查询表的所有分区的主要内容,如果未能解决你的问题,请参考以下文章

按日期范围分区 PostgreSQL 扫描所有分区

PostgreSQL分区表

PostgreSQL 创建分区表(转 仅供自己参考)

PostgreSQL 是不是并行查询分区?

PostGresql 分区表

示例讲解PostgreSQL表分区的三种方式