Re: How can I assign the result of dateadd to a variable ?

From: David Gugick (davidg-nospam_at_imceda.com)
Date: 12/15/04


Date: Wed, 15 Dec 2004 16:05:16 -0500

Paul fpvt2 wrote:
> Dear David and Hugo,
> I tried my DeleteInbatch SP on a database with about 600,000 records.
> The batch delete deleted 500,000 records in about 4 seconds. I will
> test it later with a database that has >= 5 million records, and
> hopefully the speed will carry through.
>
> What is simple recovery model ?
>
> Thanks a lot.
>

Wow. That sounds a lot more healthy. Report back when you perform the
full test.

The recovery model determines what kind of information is logged in the
database log file(s) and how long the log file sticks around:
Full recovery model logs everything and all information stays until you
back up the log file
Bulk Logged recovery model minimally logs bulk operations and fully logs
normal non-bulk operations. Using this option can make bulk
updates/loads proceed more quickly, but does impact the size of the log
when backing it up.
Simple recovery model is generally only used for development databases
or when production databases are secured from user changes (during a
nightly batch routine for instance). Simple logs the same information as
bulk logged mode, but the log is automatically truncated once it reaches
a certain size (usually a percentage of its existing size).

In all cases, the log file can grow beyond its current size if a large
transaction or set of transactions are running. That's one reason
updating a million rows in one transaction is costly. It affects the log
file and causes extreme growth. Using the simple recovery model with
batches allows the log to automatically trunate itself while the batches
are executed. You should try and keep productions users out of the
database if you change to simple recovery model for this batch.

-- 
David Gugick
Imceda Software
www.imceda.com 


Relevant Pages

  • Re: Simple recovery model + checkpoint = no need to save .ldf file?
    ... The files can also be moved to another server and ... writes all changes to the data files before the database is detached. ... you do not need the log file as sp_attach_single_file_db can be used ... > If I have a sql server 2000 database using the simple recovery model and ...
    (microsoft.public.sqlserver.server)
  • Re: Will this shrinkfile method work?
    ... There is no need to change the recovery model at all. ... If the active VLF is near the end of the log file it may take a little ... while for it to shrink but it will. ... Right click the database, choose TASKS - SHRINK - DATABASE ...
    (microsoft.public.sqlserver.setup)
  • Re: Log file growing very large??
    ... > BULK_LOGGED.Please change the recovery model for the database to ... You could truncate the transaction ... > Now execute the below command to see log file size and usage. ...
    (microsoft.public.sqlserver.msde)
  • Re: Please evaluate this approach to shrinking log files
    ... A common cause of unruly log files is that the database is in the FULL ... recovery model but regular transaction log backups are not scheduled. ... IMHO, log file ...
    (comp.databases.ms-sqlserver)
  • Re: WSUS 2.0 grew to 16 GB - need to fix
    ... It seems that the log file is growing (.ldf file) and that means that something could have changed the recovery model of the database. ...
    (microsoft.public.windows.server.sbs)