Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

How to interprete the unused space ? Expand / Collapse
Author
Message
Posted Wednesday, March 20, 2013 8:35 AM
UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Friday, April 5, 2013 4:43 PM
Points: 1,473, Visits: 1,314
In the properties of a user database, we can obtain the database size and the available space. We can shrink the database such that the available space is zero.

However, if we execute sp_spaceused against this database, we can see the unused space is not zero.

How to interprete the unused space in executing the stored procedure?
Is there any way in removing the unused space?

Many thanks in advance for any input.
Post #1433256
Posted Wednesday, March 20, 2013 8:47 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 9:56 AM
Points: 5,383, Visits: 9,951
There's a limit to how small you can shrink a database. I can't remember off the top of my head what it its - I think it's either the size of the model database or the size of the database when it was created?

Why do you want to do this, anyway? If you shrink the database, it will only grow again, unless you're going to set it as read only.

John
Post #1433269
Posted Wednesday, March 20, 2013 8:54 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, August 9, 2013 8:19 AM
Points: 179, Visits: 751
Are you talking about a production db. I would not shrink a production db POINT BLANK.
Post #1433278
Posted Wednesday, March 20, 2013 8:59 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Friday, August 9, 2013 8:19 AM
Points: 179, Visits: 751
The auto grow setting on the db has been triggered at some point and the file/s have been extended. Allowing data to be written into the free space. If you shrink it the db will grow again anyway. If you lower the setting it will extend the file more frequently at a cost of performance each time.

Make sure the auto grow is set to an appropriate amount of MB and not %. All dbs should have a decent amount of free space to grow into.

See it like this: Its the same as buying clothes for small children. You never buy clothes that just fits today always buy the size up so they can grow into it.
Post #1433281
Posted Wednesday, March 20, 2013 9:03 AM
UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Friday, April 5, 2013 4:43 PM
Points: 1,473, Visits: 1,314
John Mitchell-245523 (3/20/2013)
There's a limit to how small you can shrink a database. I can't remember off the top of my head what it its - I think it's either the size of the model database or the size of the database when it was created?

Why do you want to do this, anyway? If you shrink the database, it will only grow again, unless you're going to set it as read only.

John

Thank you so much for your input promptly.

If your statement is true, then the info on the properties of a database is confusing. The info on the properties of a database confuses people when they refer to the results when executing the sp_spaceused.

The setting in the model system database is used to set the default values. We may change any setting when creating any database, and also, we can change these settings after creating the database.

Shrinking the database such that it has zero available space is requested by our users. They use ithe database for creating reports.

Once again, tons of thanks to you.
Post #1433284
Posted Wednesday, March 20, 2013 9:04 AM
UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Friday, April 5, 2013 4:43 PM
Points: 1,473, Visits: 1,314
Bobby Glover (3/20/2013)
Are you talking about a production db. I would not shrink a production db POINT BLANK.

Thank you for your input. Unfortunately, I am asking a solution not asking why I want to do so.
Post #1433286
Posted Wednesday, March 20, 2013 9:07 AM
UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Friday, April 5, 2013 4:43 PM
Points: 1,473, Visits: 1,314
Bobby Glover (3/20/2013)
The auto grow setting on the db has been triggered at some point and the file/s have been extended. Allowing data to be written into the free space. If you shrink it the db will grow again anyway. If you lower the setting it will extend the file more frequently at a cost of performance each time.

Make sure the auto grow is set to an appropriate amount of MB and not %. All dbs should have a decent amount of free space to grow into.

See it like this: Its the same as buying clothes for small children. You never buy clothes that just fits today always buy the size up so they can grow into it.

Thank you for your input.
After executing the sp_spaceused stored procedure, I checked the properties of the database, the available space is still zero.
The database is used for creating reports, no data modification occurs.
Post #1433290
Posted Wednesday, March 20, 2013 9:11 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 9:56 AM
Points: 5,383, Visits: 9,951
SQL ORACLE (3/20/2013)Shrinking the database such that it has zero available space is requested by our users. They use ithe database for creating reports.

You're the database professional - it's OK, indeed expected, for you to tell users that they are making an inappropriate request. Users should only be concerned what data is in the database; management of free space is your job.

Unfortunately, I am asking a solution not asking why I want to do so.

Finding out why you want to do something helps us to understand your problem, and perhaps even propose a solution that you hadn't considered.

John
Post #1433294
Posted Wednesday, March 20, 2013 9:13 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 11:08 PM
Points: 20,696, Visits: 32,330
You do realize that shrinking a database will fragment the indexes used by the queries run to generate the reports and that this will impact the performance of the reporting database.




Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #1433295
Posted Wednesday, March 20, 2013 9:54 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 9:13 AM
Points: 277, Visits: 868
Unused space returned by sps_spaceused will almost never be zero.
BOL says: Total amount of space reserved for objects in the database, but not yet used.

This is extents or pages that have been allocated to an objects but are not completely full.
This is particularly true of extents (8 pages). An extent may be reserved for a given object but may have as many as 7 pages free.
Post #1433322
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse