Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Size of mdf and ldf

Author  Topic 

WindChaser
Posting Yak Master

225 Posts

Posted - 2009-02-02 : 19:23:57

Hi folks. Just looking for a bit of education.

I have a small DB where the mdf is 2MB and ldf is 2MB as well and where the recovery model is simple. I looped an Insert operation to run 100,000 times and I ended up with a 200MB mdf and a 2MB ldf. Then I deleted all the inserted records which resulted with the mdf remaining at 200MB and the ldf file blowing up to 1GB. Why would this be? I understand that the mdf container may have expanded in size even though the content is now deleted. But why would the ldf have grown if the recovery model is simple?

Thanks!

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-02-02 : 19:25:39
The insert operation was probably done in batches and therefore it was comitting and clearing the log constantly. The delete was probably done with one command and therefore one commit which meant it had to store the whole transaction in the log.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -