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 2000 Forums
 SQL Server Development (2000)
 Delete statement - Behind the scenes

Author  Topic 

ankurgupta26
Starting Member

32 Posts

Posted - 2002-10-11 : 13:44:52
I have read when a select statement is issued SQL serevr loads the data pages in memory from disk. So that when some other user runs the same query sql server will get the data directly from memory instead of getting data from disk to avoid input/Output operation as it's a resource intensive operation.

more or less same is applied for an update. only thing before making the changes permanent sql server first writes the data to log cache (write ahead log) and then to buffer cache. The lazy writter process which runs in background checks for the dirty pages and makes them permanent on the disk.

Just wondering if delete <tablename> would also work the same way
and also truncate. As we all know truncate statements can also be rolled back in sql server.

1) Let me know if my understanding is correct.
2) Your comments appreciated on how does a delete & truncate work behind the scenes.


Thanks !
AnkuR.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-10-11 : 14:30:36
Books Online describes how TRUNCATE TABLE works in some detail, at least in describing the differences from a DELETE operation. Other than that I don't know how useful it is to know the nuts and bolts of the physical operation.

I think if any resource would have more information it would be Inside SQL Server by Microsoft Press. It's a very good book to have if you want to know the real nitty-gritty about SQL Server.

Go to Top of Page
   

- Advertisement -