IBM DB2 Query Toolbox - List indexes 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 indexes by their size in Db2 database

A consulta abaixo retorna uma lista de índices em um banco de dados com o espaço que eles usam, ordenado dos que mais usam.
Query below returns list of indexes in a database with space they use ordered from the ones using most.

Resultado - Query

SELECT INDSCHEMA AS INDEX_SCHEMA
,      INDNAME AS INDEX_NAME
,      TABSCHEMA || '.' || TABNAME AS TABLE
,      INDEX_OBJECT_L_SIZE AS LOGICAL_SIZE
,      INDEX_OBJECT_P_SIZE AS PHYSICAL_SIZE
  FROM TABLE(SYSPROC.ADMIN_GET_INDEX_INFO('I','',''))
 WHERE INDSCHEMA NOT LIKE 'SYS%'
 ORDER BY PHYSICAL_SIZE
 ,        TABLE;

Colunas

  • index_schema - nome do esquema
  • index_name - nome do índice
  • tabela - nome da tabela na qual o índice é definido
  • tamanho_lógico - espaço lógico usado pelo índice.
    O tamanho lógico é a quantidade de espaço que a tabela ou partição de dados conhece.
  • tamanho_físico - espaço físico usado pelo índice

Linhas

  • Uma linha representa um índice em um banco de dados
  • Escopo das linhas: todos os índices em um banco de dados
  • Ordenado pelo tamanho do índice usado do maior ao menor, esquema da tabela e nome da tabela

Columns

  • index_schema - schema name
  • index_name - index name
  • table - table name on which index is defined
  • logical_size - logical space used by index.
    The logical size is the amount of space that the table or data partition knows about.
  • physical_size - physical space used by index

Rows

  • One row represents one index in a database
  • Scope of rows: all indexes in a database
  • Ordered by index used size from largest to smallest, table schema and table name

Resultado - Sample results


Copyright © Dataedo.