Timeline for What does the word "SARGable" really mean?
Current License: CC BY-SA 4.0
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 4, 2019 at 9:32 | history | bounty ended | Peter Vandivier | ||
Sep 19, 2018 at 8:42 | comment | added | Paul White♦ |
@EvanCarroll Take some time to read the referenced paper, and perhaps go through this answer again after that. If you still have questions that would be on-topic here, you could ask them. Note in passing that DATE() is not a real (SQL Server) function, but (I presumed) Mr. Cube's shorthand for a type conversion. We can also discuss this in chat if you like.
|
|
Sep 19, 2018 at 6:59 | comment | added | Evan Carroll |
What does "looking at the table or index record directly" mean? I'm not sure how that's explaining "directly observing the table or index record". Is x=0 SARGable? What about -0 = +0 , ' ' = '' or spatial equality? What would be an example of something that was SARGable, for sure? When you say "without recourse to database functions implemented outside the storage engine" you're including in Ypercube's example DATE() which is included inside the storage engine. Why isn't that SARGable by itself?
|
|
Sep 19, 2018 at 6:49 | comment | added | Paul White♦ | @EvanCarroll It means looking at the table or index record directly, without recourse to database functions implemented outside the storage engine (e.g. within the query processor/execution engine/expression service). In ypercube's example, the query is preprocessed by the planner/optimizer such that the non-SARGable search is expressed in SARGable terms. | |
Sep 19, 2018 at 2:46 | comment | added | Evan Carroll |
"directly observing the table or index record" what does that mean? I mean certainly = UPPER() is a function call, but so is memcmp by itself. It would be relatively easy to write a memcmp that assumes ASCII and ignores case (just look at the second nibble). Does that make it SARGABLE? Also see @Ypercube's example, dba.stackexchange.com/questions/162263/…
|
|
Sep 19, 2018 at 2:30 | history | answered | mustaccio | CC BY-SA 4.0 |