Deadlock issue

  • Hi,

    Below query is working fine without order by clause. When I add "ORDER BY a.Instance" then start getting deadlock error. Is there any way to resolve it without modifying query.

    Recently, I have restore this DB into new server. It was working fine on old server.

    SELECT

        a.Timestamp, a.Instance,

    FROM

        AUTOSYS_ALARM_HISTORY.dbo.a a

    WHERE

        a.Timestamp >= {ts '2006-01-01 00:00:00.00'} AND

        a.Timestamp < {ts '2006-02-01 00:00:00.00'} AND

        a.Instance in ('ACC','KKK','RDD','PPP')

    ORDER BY

        a.Instance

     

    Jay

  • Hello Jay

    Can you change the alias name to a different one and check out? Also change the '{' to '('.

    Thanks and have a nice day!!!


    Lucky

  • Check the error log and see what is the source of conflict.

    As in deadlock 2 queries wait for each other to release the blocking.

    See whether it is self deadlock i.e. blocker and blocked generated from same query or deadlock due to something else running at the same time.

    One character table name or even alias name is absolutely not recommended practice. Use meaningful table and alias name.

    Hope this helps.

     

     

     

     

    Kindest Regards,

    Sameer Raval [Sql Server DBA]
    Geico Insurance
    RavalSameer@hotmail.com

  • Thanks for reply..

    I had checked it was self blocking.

    I never use one charcter table name or alias. I have added  at the time of posting here because i cant post exact table as per policy.

    Regards,

    Jay

     

  • OK.

    What version of SQL server ?

    What indexes do you have on the table ?

    What is the execution plan (Query Analyzer will show you that) ?

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

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