Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Last four characters of a field
Message
 
 
To
17/10/2012 16:29:42
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01555203
Message ID:
01555214
Views:
46
This message has been marked as a message which has helped to the initial question of the thread.
>>Well, it will be
>>
>>FieldName LIKE '%[.]ext'
>>
>>This will be non-sargable, so if you can create a computed column for extension and index on it, the performance will be better.
>
>Thanks, I have additional integer index that are part of the query. So, this short out the result to about 10 to 20 records at most. If I add a condition like this, it should be pretty much fast I guess.
>
>What is non-sargable?

non-sargable means it can not utilize index on the field even if it exists. Say, if you have Date column in your table and you have an index on it and you want to get records for today this expression will be non-sargable
where datediff(day, myColum, CURRENT_TIMESTAMP) = 0
Any expression on the field are non-sargable (except for a simple CAST to date).

Also, if the search condition looking for the end of the field (as in our case), this most likely also can not use index effectively.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform