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 123»»»

SARGable Expand / Collapse
Author
Message
Posted Thursday, February 25, 2010 10:37 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, May 27, 2010 1:31 PM
Points: 132, Visits: 101
Comments posted to this topic are about the item SARGable
Post #873171
Posted Thursday, February 25, 2010 10:38 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 7:20 AM
Points: 5,367, Visits: 8,986
The "correct" answer doesn't have a column in the where clause... how can that be SARGable?

Wayne
Microsoft Certified Master: SQL Server 2008
If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
Links: For better assistance in answering your questions, How to ask a question, Performance Problems, Common date/time routines,
CROSS-TABS and PIVOT tables Part 1 & Part 2, Using APPLY Part 1 & Part 2, Splitting Delimited Strings
Post #873173
Posted Thursday, February 25, 2010 10:55 PM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Yesterday @ 8:49 PM
Points: 17,967, Visits: 15,979
WayneS (2/25/2010)
The "correct" answer doesn't have a column in the where clause... how can that be SARGable?


I would have to agree here. The lack of a column in the where clause makes none of the answers correct.




Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server, MVP


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Post #873180
Posted Thursday, February 25, 2010 11:21 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Wednesday, March 6, 2013 7:54 PM
Points: 386, Visits: 54
WayneS (2/25/2010)
The "correct" answer doesn't have a column in the where clause... how can that be SARGable?


Agreed. If the query is not RUNable then it can't be SARGable.
Post #873187
Posted Thursday, February 25, 2010 11:29 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, November 24, 2014 4:38 AM
Points: 2,301, Visits: 1,432
Agreed. ..The Answers was not properly printed wrong

A condition (or predicate) in a query is said to be sargable if the DBMS engine can take advantage of an index to speed up the execution of the query (using index seeks, not covering indexes). The term is derived from a contraction of Search Argument.
Post #873191
Posted Thursday, February 25, 2010 11:34 PM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Sunday, November 2, 2014 10:02 PM
Points: 506, Visits: 1,695
Hmmm. Either assume the pseudo code has a typo and choose the "right" answer, or take the question literally and choose the "wrong" answer. A 50/50 chance. I'm gonna have to start using dice to answer the QotD.

S.




Post #873192
Posted Friday, February 26, 2010 12:00 AM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Wednesday, October 1, 2014 11:08 AM
Points: 458, Visits: 244
Yeah, I agree with CirquedeSQLeil, The lack of a column in the where clause makes none of the answers correct
Post #873203
Posted Friday, February 26, 2010 12:20 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, April 13, 2011 12:21 AM
Points: 7, Visits: 32
Non-sargable search arguments in the WHERE clause, such as "IS NULL", "<>", "!=", "!>", "!<", "NOT", "NOT EXISTS", "NOT IN", "NOT LIKE", and "LIKE '%500'" generally prevents (but not always) the query optimizer from using an index to perform a search.

How can where clause without column name can be SARGable while index can not be performed on this?

Please correct me in case I am wrong.
Post #873209
Posted Friday, February 26, 2010 12:23 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 6:24 AM
Points: 2,682, Visits: 4,743
I noticed it only now. The first option has a column in the Where Clause. It must be a typo for sure. Anyways i got it right


Kingston Dhasian

How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #873212
Posted Friday, February 26, 2010 12:40 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Tuesday, April 1, 2014 4:38 AM
Points: 1,518, Visits: 873
SandyDB (2/26/2010)
Non-sargable search arguments in the WHERE clause, such as "IS NULL", "<>", "!=", "!>", "!<", "NOT", "NOT EXISTS", "NOT IN", "NOT LIKE", and "LIKE '%500'" generally prevents (but not always) the query optimizer from using an index to perform a search.

How can where clause without column name can be SARGable while index can not be performed on this?

Please correct me in case I am wrong.


The content of your reply looks remarkably like paragraph 2 of www.sql-server-performance.com/tips/t_sql_where_p2.aspx) .. so I'm not gonna argue with Brad MacGehee
Post #873221
« Prev Topic | Next Topic »

Add to briefcase 123»»»

Permissions Expand / Collapse