2012年3月27日星期二

disk sizw for a table

I am a novice in SQL.. i need to find a way to find the
total size occupied by a table. Is there any easy way to
accomplish this ?
Thanks in advance
Arunexec sp_SpaceUsed 'mytable'
--
Kevin Hill
President
3NF Consulting
www.3nf-inc.com/NewsGroups.htm
"Arun" <anonymous@.discussions.microsoft.com> wrote in message
news:021f01c3d953$ef2c0ba0$a601280a@.phx.gbl...
> I am a novice in SQL.. i need to find a way to find the
> total size occupied by a table. Is there any easy way to
> accomplish this ?
> Thanks in advance
> Arun|||Kevin thanks, it gave the info as i wanted ..but another
silly question...the total size for a table would be
Data size + Index size correct ?
>--Original Message--
>exec sp_SpaceUsed 'mytable'
>--
>Kevin Hill
>President
>3NF Consulting
>www.3nf-inc.com/NewsGroups.htm
>"Arun" <anonymous@.discussions.microsoft.com> wrote in
message
>news:021f01c3d953$ef2c0ba0$a601280a@.phx.gbl...
>> I am a novice in SQL.. i need to find a way to find the
>> total size occupied by a table. Is there any easy way to
>> accomplish this ?
>> Thanks in advance
>> Arun
>
>.
>|||Yes, unless there is more space reserved for the table than actually used by
the data and indexes. Check BOL for very detailed info
--
Kevin Hill
President
3NF Consulting
www.3nf-inc.com/NewsGroups.htm
<anonymous@.discussions.microsoft.com> wrote in message
news:026901c3d957$5d6b96a0$a601280a@.phx.gbl...
> Kevin thanks, it gave the info as i wanted ..but another
> silly question...the total size for a table would be
> Data size + Index size correct ?
>
> >--Original Message--
> >exec sp_SpaceUsed 'mytable'
> >
> >--
> >Kevin Hill
> >President
> >3NF Consulting
> >
> >www.3nf-inc.com/NewsGroups.htm
> >
> >"Arun" <anonymous@.discussions.microsoft.com> wrote in
> message
> >news:021f01c3d953$ef2c0ba0$a601280a@.phx.gbl...
> >> I am a novice in SQL.. i need to find a way to find the
> >> total size occupied by a table. Is there any easy way to
> >> accomplish this ?
> >> Thanks in advance
> >> Arun
> >
> >
> >.
> >|||(anonymous@.discussions.microsoft.com) writes:
> Kevin thanks, it gave the info as i wanted ..but another
> silly question...the total size for a table would be
> Data size + Index size correct ?
The number you want to look at is "reserved". This is the actual
number of space allocated for the table. SQL Server allocates space
for a table extends of 8 * 8 KB. (Save the for the first row; here
normally only 8 KB is reserved.). So normally, there is always some
free space. If there have been plenty of deletions, there can be
more.
Also, you may want to add a second parameter to sp_spaceused:
sp_spaceused tbl, true
This forces an update of the tables which holds the size data.
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp

没有评论:

发表评论