Greenplum表定义不显示详细的子表/分区&分配密钥

时间:2014-12-18 09:26:19

标签: psql database-partitioning greenplum

\d+ {table_name}

未显示详细分区&分发关键信息。

我猜可能有一些配置参数尚未设置,因为之前它显示完美。

默认情况下,它先前显示该表/ etc的所有子表/分发键。

4 个答案:

答案 0 :(得分:0)

如果\ d +会显示您的分配键;然后,您可以使用下面提到的查询来显示分配密钥。

从gp_distribution_policy中选择* where localoid =(从pg_class中选择oid,其中relname ='My_table_name');

答案 1 :(得分:0)

我敢打赌你有两个表名相同,一个在公共模式中,另一个在不同模式中。如果您没有指定模式名称,Greenplum(如PostgreSQL)将在搜索路径中列出的模式中搜索表名。将显示基于search_path顺序的第一个匹配项。

注意我没有指定架构名称,只是" \ d store_sales"但是列出的表是" public.store_sales"?它由我的search_path确定。

    gpdb=# \d store_sales
                Table "public.store_sales"
            Column         |     Type     | Modifiers 
    -----------------------+--------------+-----------
     ss_sold_date_sk       | integer      | 
     ss_sold_time_sk       | integer      | 
     ss_item_sk            | integer      | not null
     ss_customer_sk        | integer      | 
     ss_cdemo_sk           | integer      | 
     ss_hdemo_sk           | integer      | 
     ss_addr_sk            | integer      | 
     ss_store_sk           | integer      | 
     ss_promo_sk           | integer      | 
     ss_ticket_number      | integer      | not null
     ss_quantity           | integer      | 
     ss_wholesale_cost     | numeric(7,2) | 
     ss_list_price         | numeric(7,2) | 
     ss_sales_price        | numeric(7,2) | 
     ss_ext_discount_amt   | numeric(7,2) | 
     ss_ext_sales_price    | numeric(7,2) | 
     ss_ext_wholesale_cost | numeric(7,2) | 
     ss_ext_list_price     | numeric(7,2) | 
     ss_ext_tax            | numeric(7,2) | 
     ss_coupon_amt         | numeric(7,2) | 
     ss_net_paid           | numeric(7,2) | 
     ss_net_paid_inc_tax   | numeric(7,2) | 
     ss_net_profit         | numeric(7,2) | 
    Distributed by: (ss_item_sk)

我在tpcds架构中也有相同的表名,它被分区。当我指定模式名称时,我找到了正确分区的表。

    gpdb=# \d tpcds.store_sales
      Append-Only Columnar Table "tpcds.store_sales"
            Column         |     Type     | Modifiers 
    -----------------------+--------------+-----------
     ss_sold_date_sk       | integer      | 
     ss_sold_time_sk       | integer      | 
     ss_item_sk            | integer      | not null
     ss_customer_sk        | integer      | 
     ss_cdemo_sk           | integer      | 
     ss_hdemo_sk           | integer      | 
     ss_addr_sk            | integer      | 
     ss_store_sk           | integer      | 
     ss_promo_sk           | integer      | 
     ss_ticket_number      | integer      | not null
     ss_quantity           | integer      | 
     ss_wholesale_cost     | numeric(7,2) | 
     ss_list_price         | numeric(7,2) | 
     ss_sales_price        | numeric(7,2) | 
     ss_ext_discount_amt   | numeric(7,2) | 
     ss_ext_sales_price    | numeric(7,2) | 
     ss_ext_wholesale_cost | numeric(7,2) | 
     ss_ext_list_price     | numeric(7,2) | 
     ss_ext_tax            | numeric(7,2) | 
     ss_coupon_amt         | numeric(7,2) | 
     ss_net_paid           | numeric(7,2) | 
     ss_net_paid_inc_tax   | numeric(7,2) | 
     ss_net_profit         | numeric(7,2) | 
    Checksum: t
    Number of child tables: 7 (Use \d+ to list them.)
    Distributed by: (ss_item_sk)

使用\ d +显示分区。

    gpdb=# \d+ tpcds.store_sales
                                            Append-Only Columnar Table "tpcds.store_sales"
            Column         |     Type     | Modifiers | Storage | Compression Type | Compression Level | Block Size | Description 
    -----------------------+--------------+-----------+---------+------------------+-------------------+------------+-------------
     ss_sold_date_sk       | integer      |           | plain   | none             | 0                 | 32768      | 
     ss_sold_time_sk       | integer      |           | plain   | none             | 0                 | 32768      | 
     ss_item_sk            | integer      | not null  | plain   | none             | 0                 | 32768      | 
     ss_customer_sk        | integer      |           | plain   | none             | 0                 | 32768      | 
     ss_cdemo_sk           | integer      |           | plain   | none             | 0                 | 32768      | 
     ss_hdemo_sk           | integer      |           | plain   | none             | 0                 | 32768      | 
     ss_addr_sk            | integer      |           | plain   | none             | 0                 | 32768      | 
     ss_store_sk           | integer      |           | plain   | none             | 0                 | 32768      | 
     ss_promo_sk           | integer      |           | plain   | none             | 0                 | 32768      | 
     ss_ticket_number      | integer      | not null  | plain   | none             | 0                 | 32768      | 
     ss_quantity           | integer      |           | plain   | none             | 0                 | 32768      | 
     ss_wholesale_cost     | numeric(7,2) |           | main    | none             | 0                 | 32768      | 
     ss_list_price         | numeric(7,2) |           | main    | none             | 0                 | 32768      | 
     ss_sales_price        | numeric(7,2) |           | main    | none             | 0                 | 32768      | 
     ss_ext_discount_amt   | numeric(7,2) |           | main    | none             | 0                 | 32768      | 
     ss_ext_sales_price    | numeric(7,2) |           | main    | none             | 0                 | 32768      | 
     ss_ext_wholesale_cost | numeric(7,2) |           | main    | none             | 0                 | 32768      | 
     ss_ext_list_price     | numeric(7,2) |           | main    | none             | 0                 | 32768      | 
     ss_ext_tax            | numeric(7,2) |           | main    | none             | 0                 | 32768      | 
     ss_coupon_amt         | numeric(7,2) |           | main    | none             | 0                 | 32768      | 
     ss_net_paid           | numeric(7,2) |           | main    | none             | 0                 | 32768      | 
     ss_net_paid_inc_tax   | numeric(7,2) |           | main    | none             | 0                 | 32768      | 
     ss_net_profit         | numeric(7,2) |           | main    | none             | 0                 | 32768      | 
    Checksum: t
    Child tables: store_sales_1_prt_no_date_set,
                  store_sales_1_prt_y_1998,
                  store_sales_1_prt_y_1999,
                  store_sales_1_prt_y_2000,
                  store_sales_1_prt_y_2001,
                  store_sales_1_prt_y_2002,
                  store_sales_1_prt_y_2003
    Has OIDs: no
    Options: appendonly=true, orientation=column
    Distributed by: (ss_item_sk)

答案 2 :(得分:0)

我知道这里有什么错误

如果您检查DDL或从其他服务器(不是直接GP群集)转储任何表(使用pg_dump),其中客户端已安装并且已授予GP服务器连接,则通过\ d,\ d +或pg_dump生成DDL,你不会得到分发类 我刚试过分区表,分区类也会丢失。

同时如果您从psql提示符@ GP主服务器尝试\ d,\ d +或pg_dump 您将在表

的生成DDL中获得分发和分区类

您还可以尝试生成外部表格的DDL 从ETL服务器或安装GP客户端的任何其他服务器,从此psql提示符,您将不会获得Location类。

试试这个并恢复

由于

答案 3 :(得分:0)

如果您没有使用greenplum提供的psql,则不会显示“greenplum feature”。请检查您是否使用了正确的psql。