Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Query to long time running........ Expand / Collapse
Author
Message
Posted Friday, November 2, 2012 5:36 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Thursday, July 10, 2014 4:41 AM
Points: 77, Visits: 99
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 ).

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
Post #1380638
Posted Friday, November 2, 2012 5:45 PM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 7:51 PM
Points: 3,354, Visits: 7,251
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.
I am a great believer in luck, and I find the harder I work the more I have of it. Stephen Leacock

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1380640
Posted Friday, November 2, 2012 5:48 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 7:26 PM
Points: 6,157, Visits: 7,217
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 | Forum Netiquette
For index/tuning help, follow these directions. |Tally Tables

Twitter: @AnyWayDBA
Post #1380641
Posted Monday, November 5, 2012 3:21 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, July 14, 2014 4:48 AM
Points: 2,834, Visits: 3,950
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
Post #1380952
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse