TAILIEUCHUNG - Microsoft SQL Server 2008 R2 Unleashed- P121

Microsoft SQL Server 2008 R2 Unleashed- P121:SQL Server 2005 provided a number of significant new features and enhancements over what was available in SQL Server 2000. This is not too surprising considering there was a five-year gap between these major SQL Server 2008 is not as much of a quantum leap forward from SQL Server 2005 | 1144 CHAPTER 34 Data Structures Indexes and Performance Deleting Rows What happens when rows are deleted from a table How and when does SQL Server reclaim the space when data is removed from a table Deleting Rows from a Heap In a heap table SQL Server does not automatically compress the space on a page when a row is removed that is the rows are not all moved up to the beginning of the page to keep all free space at the end as SQL Server did in versions prior to . To optimize performance SQL Server holds off on compacting the rows until the page needs contiguous space for storing a new row. Deleting Rows from an Index Because the data pages of a clustered table are actually the leaf pages of the clustered index the behavior of data row deletes on a clustered table is the same as row deletions from an index page. When rows are deleted from the leaf level of an index they are not actually deleted but are marked as ghost records. Keeping the row as a ghost record makes it easier for SQL Server to perform key-range locking key-range locking is discussed in Chapter 37 Locking and Performance . If ghost records were not used SQL Server would have to lock the entire range surrounding the deleted record. With the ghost record still present and visible internally to SQL Server it is not visible in query result sets SQL Server can use the ghost record as an endpoint for the key-range lock to prevent phantom records with the same key value from being inserted while allowing inserts of other values to proceed. Ghost records do not stay around forever though. SQL Server has a special internal housekeeping process that periodically examines the leaf level of B-trees for ghost records and removes them. This is the same thread that performs the autoshrink process for databases. Whenever you delete a row all nonclustered indexes need to be updated to remove the pointers to the deleted row. Nonleaf index rows are not ghosted when deleted. As with heap tables however the space is .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.