【问题标题】:Query to find list of Column Oriented table(append_only tables) and partitioned tables查询以查找面向列的表(append_only 表)和分区表的列表
【发布时间】:2015-01-22 07:29:57
【问题描述】:

需要帮助

  1. 如何列出任何数据库中面向列的表?

  2. 如何列出在任何数据库中使用分区创建的表?

谢谢

【问题讨论】:

    标签: database greenplum


    【解决方案1】:

    在 Greenplum 中,您不能发出跨数据库查询,并且由于目录放置在每个数据库中,因此您不能同时列出“所有”数据库中的表。但是对于每个数据库,您都可以使用以下查询轻松完成:

    -- List all the column-oriented tables in current database
    select  n.nspname as schemaname,
            c.relname as tablename
        from pg_class as c, pg_namespace as n
        where c.relnamespace = n.oid
            and c.relstorage = 'c';
    
    -- List all partitioned tables in current database
    select schemaname,
           tablename,
           count(*) as num_partitions
        from pg_partitions
        group by 1, 2;
    

    【讨论】:

      【解决方案2】:

      也会有帮助

      select relname from pg_class where reloptions= '{appendonly=true,orientation=column}';
      
      select * from pg_partitions;
      

      谢谢

      【讨论】:

        猜你喜欢
        • 2012-07-05
        • 1970-01-01
        • 2020-08-06
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多