Re: Can SELECT block UPDATE?

Tech-Archive recommends: Fix windows errors by optimizing your registry



Yes, a select can block an update depending on the isolation level.

Here is a link to the SQL Server 2000 BOL topic:
http://msdn.microsoft.com/en-us/library/aa259216(SQL.80).aspx

Selecting in the READ UNCOMMITTED isolatino level, or using the NOLOCK hint, is the least restrictive locking, but as the notes explain, it has its downsides as well. You have to use your good judgment on whether those downsides are compatible with the purpose of the select.

Of course, things go wrong, but why was the select running for two hours? Was it a problem with the code? The connection? Etc?

RLF

"css" <css@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:7E1B3CAA-1A95-4986-BFE8-F23258A77A24@xxxxxxxxxxxxxxxx
We have a SQL 2000 database, this morning a job than run simple update on a
table with 18,000 rows kept running for two hours (normally it takes about
couple seconds)

I tried to find spid that was causing the block, Under SQL EM under current
activity, found that spid that was blocking to my surprise it was a select
statement. I killed that spid and update ran fine afterwords.

Based on my understanding SELECT takes a shared lock, not exclusive but can
it starv the update for two hours.

.



Relevant Pages

  • Re: Can you use osql in DTS?
    ... Dim pkg, task, spid ... Columnist, SQL Server Professional ... the variable I need to pass into a stored procedure and have it function ... >> osql. ...
    (microsoft.public.sqlserver.dts)
  • Re: Can you use osql in DTS?
    ... Dim pkg, task, spid ... Columnist, SQL Server Professional ... the variable I need to pass into a stored procedure and have it function ... >> osql. ...
    (microsoft.public.sqlserver.programming)
  • Re: isolation level is set to repeatable read
    ... Tibor, I am just suggesting that, if the isolation level is set from within ... SQL Server, then you will see the command in Profiler. ... > The only way to change this inside SQL Server is to use SET TRANSACTION ...
    (microsoft.public.sqlserver.server)
  • Re: change default isolation level on sql server 2005
    ... Have you actually set the database to Read_only? ... I believe SQL Server does some internal optimizations if it knows there will never be contention. ... I am also sure that there would be no way to change default isolation level ... "Kalen Delaney" wrote: ...
    (microsoft.public.sqlserver.programming)
  • Re: Database or store to handle 30 Mb/sec and 40,000 inserts/sec
    ... Just like I wouldn't recommend an Oracle customers snapshot isolation if their transaction must be serializable. ... This is also by far the most popular isolation level on DB2. ... SQL Server 2005, unless i'm gravely mistaken suppors two new twists. ... One of them is MVRC, the other is last committed without readers blocking writers. ...
    (comp.databases.oracle.server)