Space Allocation and Reuse

Microsoft® SQL Server™ is effective at quickly allocating pages to objects and reusing space freed up by deleted rows. These operations are internal to the system and use data structures not visible to users, yet these processes and structures are occasionally referenced in SQL Server messages. This topic is an overview of the space allocation algorithms and data structures to give users and administrators the knowledge needed to understand references to the terms in messages generated by SQL Server.

SQL Server version 7.0 introduces some significant changes to the internal data structures used to manage the allocation and reuse of pages. These data structures are not visible to users, so these changes do not affect users other than by improving speed.

SQL Server 7.0 autoshrinks databases that have a large amount of free space. Only those databases where the autoshrink option has been set to true are candidates for this process. The server checks the space usage in each database periodically. If a database is found with a lot of empty space and it has the autoshrink option set to true, SQL Server reduces the size of the files in the database. You can also use SQL Server Enterprise Manager or the DBCC SHRINKDATABASE statement to shrink the files of a database manually.

Whenever SQL Server shrinks a database, it first relocates used pages from the sections being released. You can only shrink a database to the point where it has no free space remaining.

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.