November 2, 2012 at 5:36 pm
[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]
November 2, 2012 at 5:45 pm
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.
November 2, 2012 at 5:48 pm
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.
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
November 5, 2012 at 3:21 am
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