Checking Database Object Sizes andDisk Space
The gp_size_* family of views can be usedto determine the disk space usage for a distributed Greenplum Database, schema,table, or index. The following views calculate the total size of an objectacross all primary segments (mirrors are not included in the sizecalculations).
gp_size_of_all_table_indexes
gp_size_of_database
gp_size_of_index
gp_size_of_partition_and_indexes_disk
gp_size_of_schema_disk
gp_size_of_table_and_indexes_disk
gp_size_of_table_and_indexes_licensing
gp_size_of_table_disk
gp_size_of_table_uncompressed
gp_disk_free
表和索引大小视图按对象ID(不按名称)列出关系。 要按名称检查表或索引的大小,必须在pg_ciass表中查找关系名(重新命名)。 例如:
SELECT reinameas name, sotdsize as size, sotdtoastsize as toast, sotdadditionalsize as otherFROM gp_size_of_table_disk as sotd, pg_class WHERE sotd.sotdoid=pg_class.oidORDER BY relname;
gp_size_of_all_table_indexes
该视图显示表格的所有索引的总大小。 所有用户都可以访问此视图,但非超级用户只能查看他们有权访问的关系。
Table 120: gp_size_of_all_table_indexesview
Column |
描述 |
soatioid |
表格的对象ID |
soatisize |
所有表索引的总大小(以字节为单位) |
soatischemaname |
模式名称 |
soatitablename |
表名 |
gp_size_of_database
该视图显示数据库的总大小。 所有用户都可以访问这个视图,但是非超级用户只能看到他们有权访问的数据库。
Table 121:gp_size_of_database view
Column |
描述 |
sodddatname |
数据库名 |
sodddatsize |
数据库的大小(以字节为单位) |
gp_size_of_index
该视图显示索引的总大小。 所有用户都可以访问此视图,但非超级用户只能查看他们有权访问的关系。
Table 122:gp_size_of_index view
Column |
描述 |
soioid |
索引的对象ID |
soitableoid |
索引所属的表的对象ID |
soisize |
索引的大小以字节为单位 |
soiindexschemaname |
索引架构的名称 |
soiindexname |
索引的名称 |
soitableschemaname |
表架构的名称 |
soitablename |
表格的名称 |
gp_size_of_partition_and」ndexes_disk
该视图显示分区子表及其索引的磁盘大小。 所有用户都可以访问此视图,但非超级用户只能查看他们有权访问的关系
Table 123:gp_size_of_partition_and_indexes_disk view
Column |
描述 |
sopaidparentoid |
父表的对象ID |
sopaidpartitionoid |
分区表的对象ID |
sopaidpartitiontablesize |
分区表大小(以字节为单位) |
sopaidpartitionindexessize |
此分区上所有索引的总大小 |
Sopaidparentschemaname |
父模式的名称 |
Sopaidparenttablename |
父表的名称 |
Sopaidpartitionschemaname |
分区模式的名称 |
sopaidpartitiontablename |
分区表的名称 |
gp_size_of_schema_disk
该视图显示了当前数据库中的公共模式和用户创建的模式的模式大小。 所有用户都可以访问此视图,但是非超级用户将只能看到他们有权访问的模式。
Table 124:gp_size_of_schema_disk view
Column |
描述 |
sosdnsp |
架构的名称 |
sosdschematablesize |
模式中表的总大小(以字节为单位) |
sosdschemaidxsize |
模式中索引的总大小(以字节为单位) |
gp size of table and indexes disk
这个视图显示了磁盘上表的大小和索引。 所有用户都可以访问此视图,但非超级用户只能查看他们有权访问的关系。
Table 125:gp_size_of_table_and_indexes_disk view
Column |
描述 |
sotaidoid |
父表的对象ID |
sotaidtablesize |
表的磁盘大小 |
sotaididxsize |
表中所有索引的总大小 |
sotaidschemaname |
架构的名称 |
sotaidtablename |
表格的名称 |
gp_ size_of_table_and_indexes_licensing
This view shows the total size of tablesand their indexes for licensing purposes. The use of this view requiressuperuser permissions.
Table 126:gp_size_of_table_and_indexes_licensing view
Column |
描述 |
sotailoid |
表格的对象ID |
sotailtablesizedisk |
表的总磁盘大小 |
sotailtablesizeuncompressed |
如果该表是压缩的附加优化表,则以字节为单位显示未压缩的表大小。 |
sotailindexessize |
表中所有索引的总大小 |
sotailschemaname |
模式名称 |
sotailtablename |
表名 |
gp size of table disk
This view shows the size of a table ondisk. This view is accessible to all users, however non-superusers will only beable to see tables that they have permission to access
Table 127:gp_size_of_table_disk view
Column |
描述 |
sotdoid |
表格的对象ID |
sotdsize |
表的大小(以字节为单位)。 大小只是主桌大小。 大小不包括辅助对象,如超大(Toast)属性或AO表的附加存储对象。 |
sotdtoastsize |
如果有的话,TOAST表的大小(过大的属性存储)。 |
sotdadditionalsize |
反映附加优化(AO)表的段和块目录表大小。 |
sotdschemaname |
模式名称 |
sotdtablename |
表名 |
|
gp_size_of_table_uncompressed
此视图显示附加优化(AO)表的未压缩表大小。 否则,显示磁盘上的表大小。 使用此视图需要超级用户权限。
Table 128: gp_size_of_table_uncompressed view
|
|
gp_disk_free
此外部表在活动的段主机上运行df(磁盘可用)命令并报告结果。 计算中不包含非活动镜像。 使用此外部表需要超级用户权限。
Table 129: gp_disk_free external table
|