DB2 List the Five Largest Tables in a DB2 Database

DB2 List the Five Largest Tables in a DB2 Database

 

  

Hey John,
The answer to your question "Do you have a script to list the five
largest tables in a DB2 database?" is yes. Check out the code below.
Hehe.

select char(t.tabschema,24) as tabschema
,char(t.tabname,24) as tabname
,(ts.pagesize * t.fpages ) as tablesize_in_bytes
,card as row_count
from syscat.tablespaces ts
join syscat.tables t on t.tbspace = ts.tbspace
where t.tabname is not null
and t.tabschema = 'DEPDB'
order by row_count desc
FETCH FIRST 5 ROWS ONLY
OPTIMIZE FOR 5 ROWS;


Please take a few minutes to provide feedback on the quality of service you received from our staff. The Department of Education values your feedback as a customer. Commissioner of Education Dr. Eric J. Smith is committed to continuously assessing and improving the level and quality of services provided to you.Simply use the link below. Thank you in advance for completing the survey.


http://data.fldoe.org/cs/default.cfm?staff=Ed.[Email address protected]

DB2 & UDB email list listserv db2-l LazyDBA home page