Re: MSSQL Optimize?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Mssql server has a list of tools you can use for this. When you create the
database (or later modify it through Enterprice Manager) you can specify
'Auto Shrink'. This will make sure the file sise is optimized when you
delete data.

This cal also be done with this call:

sp_dboption('database', 'autoshrink', 'true')

You can also do this on request. This section is taken from the MSSQL
documentation.

DBCC SHRINKDATABASE 
    (    database_name [, target_percent]
        [, {NOTRUNCATE | TRUNCATEONLY}]
    )

Arguments
database_name 
Is the name of the database to be shrunk. Database names must conform to
the rules for identifiers. For more information, see Using Identifiers. 
target_percent 
Is the desired percentage of free space left in the database file after
the database has been shrunk. 
NOTRUNCATE 
Causes the freed file space to be retained in the database files. If not
specified, the freed file space is released to the operating system. 
TRUNCATEONLY 
Causes any unused space in the data files to be released to the operating
system and shrinks the file to the last allocated extent, reducing the
file size without moving any data. No attempt is made to relocate rows to
unallocated pages. target_percent is ignored when TRUNCATEONLY is used. 

- Frank

> Please forgive me for being somewhat off topic.
> This information is going towards a db class written in php.
> Does MSSQL have an SQL command counterpart to mysql's Optimize or
> postgresql's Vacuum??
> Thanks for any insight you may provide...
> 
> 
> 
> -- 
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 




-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux