Query to long time running........

  • [font="Arial"]Hello,

    I've got to troubleshoot the following query but i'm lost since they've got one select "*" in the beginning of the query and in the where clause they got a like that i think its the problem.

    I'm limited too in the field of the date but .... dont know how to check it!!! (i think :crazy:).

    Can anyone tell me what should i do or should i do not do anything?

    Sorry, thanks and regards 😉

    SELECT * FROM tblname WITH(NOLOCK)

    WHERE FiledDate > '2012-11-01 00:00:00.000'

    AND FieldDescr LIKE 'xptonumber%'

    ORDER BY FieldCodDesc DESC[/font]

  • You should take a look at Gail's article with suggestions to post performance issues.

    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

    It might not affect performance, but you should beware of the dangers of using NOLOCK.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • If you take a look in my signature for the link regarding indexes/tuning, we can help you further.

    The like is SARGable, no big deal. As is the date. The order by be hurting depending on the # of rows returned, and because you've got two non-equality conditions no index can cover both.

    I don't see anything particularly wrong with the query as long as your end users are prepared for bad data from the use of NOLOCK on occassion.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • Any index on FiledDate OR FieldDescr column ? if not then create tow separate indexes.

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

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

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