使用 UNIX SAS 查找 Netezza 表的大小

发布于 2024-10-13 11:42:27 字数 92 浏览 2 评论 0原文

可以使用哪些语法/表来确定 Netezza 表的大小 (Gbs)?我通过 UNIX SAS(ODBC 或 libname 引擎)进行访问。我假设有一个视图可以提供此信息?

What syntax / tables can be used to determine the size (Gbs) of a Netezza table? I am accessing via UNIX SAS (either ODBC or libname engine). I assume there is a view which will give this info?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

离不开的别离 2024-10-20 11:42:27

因此,您对两个系统视图 _v_obj_relation_xdb 和 _v_sys_object_dslice_info 感兴趣。第一个 (_v_obj_relation_xdb) 包含表信息(名称、类型等),第二个 (_v_sys_object_dslice_info) 包含每个磁盘的大小信息。您可能想查看这两个表,以便更好地了解您真正想要的内容,但简单的查询是:

select objname, sum(used_bytes) size_in_bytes
from _V_OBJ_RELATION_XDB 
join _V_SYS_OBJECT_DSLICE_INFO on (objid = tblid) 
where objname = 'UPPERCASE_TABLE_NAME'
group by objname

这将返回表的大小(以字节为单位),我将把转换保留为 GB作为读者的练习。还有一些其他有趣的字段,因此您可能想查看这些视图。

So you're interested in two system views _v_obj_relation_xdb and _v_sys_object_dslice_info. The first (_v_obj_relation_xdb) contains the table information (name, type, etc.) and the second (_v_sys_object_dslice_info) contains the size per disk information. You probably want to take a look at both of those tables to get a good idea of what you're really after, but the simple query would be:

select objname, sum(used_bytes) size_in_bytes
from _V_OBJ_RELATION_XDB 
join _V_SYS_OBJECT_DSLICE_INFO on (objid = tblid) 
where objname = 'UPPERCASE_TABLE_NAME'
group by objname

This returns the size of the table in bytes and I'll leave the conversion to GB as an exercise to the reader. There are some other interesting fields there so you might want to check out those views.

为人所爱 2024-10-20 11:42:27

您还可以使用 (_v_sys_object_storage_size )

   select   b.objid
            ,b.database as db
            ,lower(b.objname) as tbl_nm
            ,lower(b.owner) as owner
            ,b.objtype
            ,d.used_bytes/pow(1024,3) as used_gb
            ,d.skew
            ,cast(b.createdate as timestamp) as createdate_ts
            ,cast(b.objmodified as timestamp) as objmodified_ts

     from _v_obj_relation_xdb b inner join
          _v_sys_object_storage_size d
          on    b.objid=d.tblid
          and lower(b.objname) = 'table name'

You could also use (_v_sys_object_storage_size )

   select   b.objid
            ,b.database as db
            ,lower(b.objname) as tbl_nm
            ,lower(b.owner) as owner
            ,b.objtype
            ,d.used_bytes/pow(1024,3) as used_gb
            ,d.skew
            ,cast(b.createdate as timestamp) as createdate_ts
            ,cast(b.objmodified as timestamp) as objmodified_ts

     from _v_obj_relation_xdb b inner join
          _v_sys_object_storage_size d
          on    b.objid=d.tblid
          and lower(b.objname) = 'table name'
潦草背影 2024-10-20 11:42:27

磁盘上的大小 (used_bytes) 表示压缩数据,并包括表中任何已删除行的存储空间。

表行计数统计(reltuples)通常非常准确,但它只是一个统计数据,并不能保证与“select count(*)”表行计数匹配。

您可以通过目录查询获取此信息

select tablename, reltuples, used_bytes from _v_table_only_storage_stat where tablename = ^FOOBAR^;

The size on disk (used_bytes) represents compressed data and includes storage for any deleted rows in the table.

The table rowcount statistic (reltuples) is generally very accurate, but it is just a statistic and not guaranteed to match the "select count(*)" table rowcount.

You can get this information via a catalog query

select tablename, reltuples, used_bytes from _v_table_only_storage_stat where tablename = ^FOOBAR^;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文