IBM DB2 Query Toolbox - List tables by their size in Db2 database



Desenvolvido por DORNELLES Carlos Alberto - Analista de Sistemas - Brasília DF. - cad_cobol@hotmail.com

IBM Db2 Query Toolbox - List tables by their size in Db2 database

A consulta abaixo retorna tabelas em um banco de dados com espaço que eles usam ordenados daqueles que usam mais.
Query below returns tables in a database with space they use ordered from the ones using most.

Consulta - Query

SELECT TABSCHEMA || '.' || TABNAME AS TABLE
,      DECIMAL((DATA_OBJECT_P_SIZE + INDEX_OBJECT_P_SIZE +
            LONG_OBJECT_P_SIZE + LOB_OBJECT_P_SIZE +
            XML_OBJECT_P_SIZE)/1024,10,2) AS PHYSICAL_SPACE
,      DECIMAL((DATA_OBJECT_L_SIZE + INDEX_OBJECT_L_SIZE +
            LONG_OBJECT_L_SIZE + LOB_OBJECT_L_SIZE +
            XML_OBJECT_L_SIZE)/1024,10,2) AS LOGICAL_SPACE
  FROM SYSIBMADM.ADMINTABINFO
 WHERE TABSCHEMA NOT LIKE 'SYS%'
 ORDER BY PHYSICAL_SPACE DESC

Colunas

  • tabela - nome da tabela com nome do esquema
  • Physical_space - espaço em disco alocado fisicamente para a tabela em MB
  • espaço_lógico - espaço em disco alocado logicamente para a tabela em MB.
    O tamanho lógico é a quantidade de espaço que a tabela conhece.

Linhas

  • Uma linha representa uma tabela em um banco de dados
  • Escopo das linhas: todas as tabelas em um banco de dados
  • Ordenado pelo tamanho físico da tabela, do maior ao menor

Columns

  • table - table name with schema name
  • physical_space - disk space physically allocated for the table in MB
  • logical_space - disk space logically allocated for table in MB.
    The logical size is the amount of space that the table knows about.

Rows

  • One row represents one table in a database
  • Scope of rows: all tables in a database
  • Ordered by table physical size, from largest to smallest

Resultado - Sample results


Copyright © Dataedo.