Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What is faster in a SQL Select Char or Integer?
Message
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Versions des environnements
SQL Server:
SQL Server 2005
Divers
Thread ID:
01520691
Message ID:
01520700
Vues:
35
>>Gregory,
>>
>>I am sorry but your message is not 100% clear (and it is probably just me). You are saying the 1st but then you refer to the second case with the word "only". Could you please clarify? Thank you.
>
>Are you expecting the field to have leading spaces?
>
>I suggest you to try both scenarios
>
>select fields from ... where LEN(LTRIM(CharField)) > 0
>
>select fields from ... where IntField < 1000
>
>and compare the execution plans (in percentage, at least).
>
>I would expect the second to win, but it may be not as clear, so at least some testing (even with light load for now) is required from your part.
>
>BTW, you don't need RTRIM() for the LEN function as it automatically removes trailing spaces.

Thank you for your suggestions. But the LTRIM() is still necessary with LEN()? otherwise, LEN() will return the size of the column; correct?

As to testing, sorry no time for that. I have to trust yours and Gregory's judgement and go with that. If things don't work, at least I have some smart people I can blame <g>
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform