četrtek, 31. januar 2008

Total size of a table in DB2

If you wonder how to get the total size of a table in DB2 you can use following SQL statement which gives you 30 largest tables:
SELECT TABSCHEMA, TABNAME, DATA_OBJECT_P_SIZE + INDEX_OBJECT_P_SIZE + LONG_OBJECT_P_SIZE + LOB_OBJECT_P_SIZE + XML_OBJECT_P_SIZE AS TOTAL_SIZE FROM SYSIBMADM.ADMINTABINFO ORDER BY TOTAL_SIZE DESC FETCH FIRST 30 ROWS ONLY WITH UR

Total size here means size of data + size of indexes + size of long objects + size of LOB objects + size of XML objects.
More about this can be found at IBM DB2 InfoCenter or directly here.

Ni komentarjev: