Table Sizes | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Table Sizes

I have trouble finding a system table or a INFORMATION_SCHEMA view that would give me a list of table sizes, similar to the database size in master..sysaltfiles. I know that DBCC CHECHTABLE provides that info, i just need to access it in a table format. SWeko has spoken
I’m not developer and I sure some member expert would write much better than I. select si.rows as ‘Rows’, SO.Name as Tabla
from sysobjects as SO
join sysindexes as SI
on SO.Id = SI.id
where si.impid = -1
order by si.rows desc, SO.Name Luis Martin
Moderator
SQL-Server-Performance.com One of the symptoms of an approaching nervous breakdown is the belief that one’s work is terribly important
Bertrand Russell
All postings are provided “AS IS” with no warranties for accuracy.
This just gives the number of rows in the tables (albeit very fast <img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />) but i need the actual number of data pages consumed by the tables.
<pre id="code"><font face="courier" size="2" id="code"><br />SELECT <br /> used AS "# of Pages"<br /> , rows AS "# of Rows"<br /> , (used * <img src=’/community/emoticons/emotion-11.gif’ alt=’8)’ /> / 1024 AS "# of MB"<br /> , CAST(OBJECT_NAME(id) AS CHAR(30)) AS TableName<br />FROM <br /> sysindexes <br />/*WHERE<br /> indid IN(1,2,255)*/<br />ORDER BY<br /> used <br />DESC<br /></font id="code"></pre id="code"><br />You might want to run sp_spaceused @updateusage=true before.<br /><br />–<br />Frank<br /<a target="_blank" href=http://www.insidesql.de>http://www.insidesql.de</a><br />
I told you.
Thanks Frank, new query to store in my library.
Luis Martin
Moderator
SQL-Server-Performance.com One of the symptoms of an approaching nervous breakdown is the belief that one’s work is terribly important
Bertrand Russell
All postings are provided “AS IS” with no warranties for accuracy.
I feel sooo stupid now.<br />I always assumed that those numbers meant only the index data pages used, not the actual data pages for the entire table.<br /><br />I guess that a RTFM is in order <img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />
]]>