Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Do index intermediate levels reflect the delete changes immediately, or after ghost-cleanup process finish deleted-records cleanup process?

$
0
0

Hello everyone,

I have  a question.

---------------Script---------------------------------------

use AdventureWorks;

go

select * into test

from sales.SalesOrderDetail (nolock)

go

alter table test add primary key (SalesOrderDetailID)

-- SalesOrderDetailID int,identity,max:121317

go

set statistics io on

select MIN (SalesOrderDetailID) from  test --logical reads:3

set statistics io off

go

delete from test  where  SalesOrderDetailID <= 121317

go

set statistics io on

select MIN (SalesOrderDetailID) from  test --logical reads:2999

set statistics io off

-------------------------------------------------------------

So my questions are:

1:Why the two select querys logical IO differ so much?

2:Are index intermediate levels reflect the delete changes immediately, or after ghost-cleanup process finish deleted-records cleanup process?

please forgive me my poor english,thanks.


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>