February 25, 2010 at 10:38 pm
The "correct" answer doesn't have a column in the where clause... how can that be SARGable?
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
February 25, 2010 at 10:55 pm
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[/url]
Learn Extended Events
February 25, 2010 at 11:21 pm
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. 😀
February 25, 2010 at 11:29 pm
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.
February 25, 2010 at 11:34 pm
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.
February 26, 2010 at 12:00 am
Yeah, I agree with CirquedeSQLeil, The lack of a column in the where clause makes none of the answers correct
February 26, 2010 at 12:20 am
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.
February 26, 2010 at 12:23 am
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:-)
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
February 26, 2010 at 12:40 am
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 http://www.sql-server-performance.com/tips/t_sql_where_p2.aspx) .. so I'm not gonna argue with Brad MacGehee 😉
February 26, 2010 at 12:44 am
...I too got it right..
Am sure, it's a just a typo..
February 26, 2010 at 2:00 am
Hmm, I was more bothered by the fact that NOT IN() is assumed to NOT be SARGable... In SQL 2000 this was always true when there was more than one value in the NOT IN() parentheses, but as of SQL 2005 the optimizer does a pretty good job of using indexes even then!
http://poorsql.com for T-SQL formatting: free as in speech, free as in beer, free to run in SSMS or on your version control server - free however you want it.
February 26, 2010 at 2:41 am
So my answer was wrong according to what the question should have said. In that case my answer was a typo, can i have the point please.
Martin
February 26, 2010 at 3:44 am
Once again a crap QotD.
Just choose whatever you want. It may be right or wrong anyways. Leaves a QotD without value for the community.
Best regards,
Dietmar Weickert.
February 26, 2010 at 6:38 am
I have to agree with the complainers here.
When one of the answers is none of the above, how do I know the abscence of a column name is accidental or intentional?
I could have picked the one with LIKE 'A%', but the first thing I thought was... you can't do that... so it can't be SARGable and the None of the above is there.
If I had picked it, I'd just as likely have hit a "None of the above, because WHERE LIKE 'A%' is invalid SQL syntax and is thus non-SARGable'
Viewing 15 posts - 1 through 15 (of 29 total)
You must be logged in to reply to this topic. Login to reply