Wednesday, March 7, 2012

Blocking

I am doing an insert into a table which is taking forever
2 hrs and still waiting for 20 million records
But while its doing the insert i am able to do
select count(*) from table and its giving me 0
my question how cum select is not blocked by above insert
sanjaySanjay,
You might read some under this topic:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/acdata/ac_8_con_7a_6fhj.asp
And this topic:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/architec/8_ar_sa2_2sit.asp
SQL Server default is to use the isolation level "Read committed". This
means that it will read the rows already there, but none of those in the
insert transaction.
By the way, you are apparently inserting 20 million records in a single
transaction. This will take much longer and use way more log space than
inserting them in smaller chunks. FWIW, I usually keep the insert blocks
down to about 10,000 rows, but that is not a scientific number. :)
Russell Fields
"Sanjay" <sanjayg@.hotmail.com> wrote in message
news:03a501c34578$ce926ac0$a101280a@.phx.gbl...
> I am doing an insert into a table which is taking forever
> 2 hrs and still waiting for 20 million records
> But while its doing the insert i am able to do
> select count(*) from table and its giving me 0
> my question how cum select is not blocked by above insert
> sanjay

No comments:

Post a Comment