表的DB2大小 [英] DB2 Size of Table

查看:321
本文介绍了表的DB2大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出模式中每个表的大小(kb)。我有一个查询设置,但我不知道我是否得到正确的输出。我正在运行DB2 v9 LUW。

I'm trying to figure out the size in kb of each table in a schema. I have a query set up, but I'm not sure if I'm getting the correct output. I'm running DB2 v9 LUW.

我的查询:

SELECT T.TABNAME, T.TABSCHEMA, COLCOUNT, TYPE, (DATA_OBJECT_P_SIZE + INDEX_OBJECT_P_SIZE + LONG_OBJECT_P_SIZE + LOB_OBJECT_P_SIZE + XML_OBJECT_P_SIZE) AS TOTAL_SIZE 
FROM SYSCAT.TABLES AS T, SYSIBMADM.ADMINTABINFO AS A 
WHERE T.TABNAME = A.TABNAME 

它的作品和全部,但我相当确定在这个计算中需要划分。任何建议?

It works and all, but I am fairly sure that division is required in this calculation. Any suggestions?

推荐答案

查询中的所有列都是KB。

All columns in your query is in KB.

如果要查看大小,请以KB为单位,但如果您希望以MB为单位,则将结果除以1024。

If you want to see the size in KB then leave it as is but if you want them in MB, divide the result by 1024.

或者,您可以使用这个查询:

Alternatively, you can use this query:

SELECT 
  T.TABNAME, 
  T.TABSCHEMA, 
  COLCOUNT, 
  TYPE, 
  (DATA_OBJECT_P_SIZE + INDEX_OBJECT_P_SIZE + LONG_OBJECT_P_SIZE + LOB_OBJECT_P_SIZE + XML_OBJECT_P_SIZE) AS TOTAL_SIZE_IN_KB,
  (DATA_OBJECT_P_SIZE + INDEX_OBJECT_P_SIZE + LONG_OBJECT_P_SIZE + LOB_OBJECT_P_SIZE + XML_OBJECT_P_SIZE)/1024 AS TOTAL_SIZE_IN_MB,  
  (DATA_OBJECT_P_SIZE + INDEX_OBJECT_P_SIZE + LONG_OBJECT_P_SIZE + LOB_OBJECT_P_SIZE + XML_OBJECT_P_SIZE) / (1024*1024) AS TOTAL_SIZE_IN_GB
FROM SYSCAT.TABLES AS T, SYSIBMADM.ADMINTABINFO AS A 
WHERE T.TABNAME = A.TABNAME 

这篇关于表的DB2大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆