Quantcast
Channel: SCN: Message List - SAP Applications on SAP Adaptive Server Enterprise (SAP ASE)
Viewing all articles
Browse latest Browse all 3678

Re: How to list the sizes of all tables (data and index seperately) ?

$
0
0

But you said you have SQL Commandline...

 

You may use this:

 

select top 100 --or any other top number

          left(a.name, 50) as TableName,

          left(b.name, 50) as IndexName,

          c.rowcnt as Rows,

          c.pagecnt*2 as DataKBytes,

          c.leafcnt*2 as IndexKBytes,

          c.pagecnt*2 + c.leafcnt*2 as TotalKBytes

from {YOURDB}..sysobjects a,

       {YOURDB}..sysindexes b,

       {YOURDB}..systabstats c

where b.id = a.id

   and c.id = a.id

   and c.indid = b.indid

order by 3 desc --or any other column from the result set


You can aggregate it with sum() on each numerical column and add group by left(a.name, 50), left(b.name, 50) to have it displayed in one row per one table - if you don't want break down by indices...  You might want to run sp_flushstats to flush in-memory statistics to disk first - but you will probably not be able to, so expect imprecision.


Have fun...



Viewing all articles
Browse latest Browse all 3678


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>