Deadlocks on a simple select statement

  • Hi,

    We are using a sql server 2000 database for this .

    When i run the following sql statement i get sometimes a deadlock with or without readpast?

    Select top 100 * from P01 WITH(READPAST) where inuse=0 and mo_id='' and Status= 2 and _preprocessed <> 3 and (Date_Create > GETDATE() - 2) ORDER BY prio,retries, id

    there are other processes running on this table but i do not understand why a simple select causes this deadlock

    Any ideas why or how to solve this ?

    Thanks in advance

    Peter

  • Turn on a deadlock trace (Books Online has details), and you'll find out exactly what's causing it.

    Most likely, some other process is trying to update the same information you're trying to read.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • http://support.microsoft.com/kb/297466


    N 56°04'39.16"
    E 12°55'05.25"

  • Hi thanks for your answer ,

    I only see there is a cursor update on the same table.

    But how can a simple select cause a deadlock so often.

    Is there a way to solve this?

    gr.

    Peter

  • Deadlocks occur at the resource level. It may be deadlocking on pages within the table.

    Try the below steps to find out what is the other process in the deadlock.

    http://support.microsoft.com/kb/832524

    You may be able to sort this out with indexes on the fields in your where clause.



    Nuke the site from orbit, its the only way to be sure... :w00t:

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply