Link to home
Start Free TrialLog in
Avatar of James Murrell
James MurrellFlag for United Kingdom of Great Britain and Northern Ireland

asked on

What does Reserved space mean

What does Reserved space mean when running sp_spaceused ?

reason for asking a 4 year old db has grown 6gb in 30 days... normally only grows 100mb per month max

this is in sql 2000 sp4

Avatar of RiteshShah
RiteshShah
Flag of India image

reserved space mean actual space hold by the sql engine, suppose 1GB is reserved space and used & indexed space is 500MB than you can truncate the file and can reclaim remaining space.
Avatar of Guy Hengel [angelIII / a3]
what is the sp_spaceused return, exactly?
do you have tables without clustered indexes?
what is the fragmentation of the tables?

and the "guess into the blue":
you are not eventually hit by sql injection, which appends some <script> into all the text/varchar fields, blowing up the size ?
Avatar of James Murrell

ASKER

ok run script below

results

name                          rows                     reserved               data             index_size       unused  

Audit_Booking_Plan       8365403        6574168 KB       1222632 KB       24 KB          5351512 KB

Have another 200 db same none ever had this
create table #t
(
name nvarchar(128),
rows varchar(50),
reserved varchar(50),
data varchar(50),
index_size varchar(50),
unused varchar(50)
)
 
declare @id nvarchar(128)
declare c cursor for
select name from sysobjects where xtype='U'
 
open c
fetch c into @id
 
while @@fetch_status = 0 begin
 
insert into #t
exec sp_spaceused @id
 
fetch c into @id
end
 
close c
deallocate c
 
select * from #t
order by convert(int, substring(data, 1, len(data)-3)) desc
 
drop table #t

Open in new window

please answer all my questions :)
sorry Angeleyes, was not able to remote access machine last night..

unsure about Clustered indexes

DBCC SHOWCONTIG scanning 'Audit_Booking_Plan' table...
Table: 'Audit_Booking_Plan' (209435820); index ID: 0, database ID: 9
TABLE level scan performed.
- Pages Scanned................................: 161283
- Extents Scanned..............................: 110618
- Extent Switches..............................: 110617
- Avg. Pages per Extent........................: 1.5
- Scan Density [Best Count:Actual Count].......: 18.23% [20161:110618]
- Extent Scan Fragmentation ...................: 12.60%
- Avg. Bytes Free per Page.....................: 4917.9
- Avg. Page Density (full).....................: 39.24%
apologies major problems kept me away

do you have tables without clustered indexes? only one one that table no other clustered on any table
confused.... do your tables have clustered indexes or not?
all?
only table called Audit_Booking_Plan  has clustered index

I see.
please get a clustered index on all the tables.
how would that help? sorry to ask something i should already know
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks once again angeleyes.......
where would we be without you angeleyes