|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 1:07 AM
Points: 1,370,
Visits: 2,287
|
|
...I too got it right.. Am sure, it's a just a typo..
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Sunday, April 14, 2013 8:55 AM
Points: 1,383,
Visits: 1,212
|
|
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.
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 11:11 AM
Points: 1,242,
Visits: 473
|
|
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
|
|
|
|
|
SSCommitted
      
Group: General Forum Members
Last Login: Friday, January 11, 2013 8:20 AM
Points: 1,608,
Visits: 373
|
|
Once again a crap QotD.
A missing column name a typo? Hard to believe. No info about indices on the table/view to be queried? Who could potentially know about SARGable operators. And even if there were this information, who is able to predict the optimizers way to treat a query.
Just choose whatever you want. It may be right or wrong anyways. Leaves a QotD without value for the community.
Best regards, Dietmar Weickert.
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Today @ 1:06 AM
Points: 3,226,
Visits: 64,103
|
|
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'
--Mark Tassin MCITP - SQL Server DBA Proud member of the Anti-RBAR alliance. For help with Performance click this link For tips on how to post your problems
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Today @ 12:59 AM
Points: 3,188,
Visits: 4,141
|
|
I think the typo is quite obvious. Thanks to the author: the question was very useful to me, due to the question I learned the new word 'sargable'
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Friday, July 22, 2011 4:13 AM
Points: 1,149,
Visits: 603
|
|
I got this right because I read the question quickly and didn't notice the missing columns.
However, I have gotten these questions wrong before where there were deliberate 'mistakes' like this. If this question stood on it's own then it is just a typo. Some questions rely on you spotting or not spotting invalid SQL so the assumption of a typo is dangerous (if losing a point is considered a danger).
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Thursday, May 16, 2013 11:11 AM
Points: 1,242,
Visits: 473
|
|
no, no, no, i should not have to guess or assume what the question 'should' say.
 Martin
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Wednesday, May 15, 2013 5:22 AM
Points: 1,037,
Visits: 1,354
|
|
Dietmar Weickert (2/26/2010)
No info about indices on the table/view to be queried? Who could potentially know about SARGable operators. And even if there were this information, who is able to predict the optimizers way to treat a query.
To answer the first question, a SARGable operation is not necessarily one that is working on an indexed column. A SARGable operation is one that would provide a better result if the column were indexed. So you don't need to know if there is an index to know it's a SARGable operation.
To answer the second question, I'd say anyone whose spent a few hours researching performance tuning in SQL server would have a pretty good idea. That's the whole point of SARGable operations -- they've been identified by people who know how the optimizer works as ones which generally enable the query optimizer to use an index to improve performance. You identify them first, and then you know where indexes would help (or not, as the case may be.)
|
|
|
|
|
SSC-Dedicated
           
Group: Administrators
Last Login: Yesterday @ 9:03 PM
Points: 31,406,
Visits: 13,723
|
|
|
|
|