Database 查询以查找面向列的表(仅附加表)和分区表的列表

Database 查询以查找面向列的表(仅附加表)和分区表的列表,database,greenplum,Database,Greenplum,需要帮助吗 如何列出任何数据库中面向列的表 如何列出在任何数据库中使用分区创建的表 感谢在Greenplum中,您不能发出跨数据库查询,并且由于目录位于每个数据库中,因此您不能同时列出“所有”数据库中的表。但是,对于每个数据库,您都可以通过以下查询轻松实现: -- List all the column-oriented tables in current database select n.nspname as schemaname, c.relname as tablena

需要帮助吗

  • 如何列出任何数据库中面向列的表

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


  • 感谢

    在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;
    
    这也会有所帮助

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