Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Last four characters of a field
Message
 
 
À
17/10/2012 16:29:42
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01555203
Message ID:
01555214
Vues:
45
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform