|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Thursday, March 14, 2013 11:00 AM
Points: 444,
Visits: 807
|
|
mister.magoo (2/22/2013)
Usman Butt (2/22/2013)
L' Eomot Inversé (2/22/2013)
mister.magoo (2/22/2013) What bothered me was that feeling that "someone should have thought of this ages ago, shouldn't they"? Always makes me nervous when that is the case...That feeling was bothering me too - I can't understand why I didn't spot the opportunity the first time I looked at the code, let alone why Jeff or Paul or another of the top experts who contribute so much to SQLServerCentral didn't do it long ago. Looks as if you're the only one who's awake around here, Mr M.  IIRC, Jeff Moden already knows it. But I guess the conversation we had somewhere else was something like that he likes to use the default collation. (I may be wrong. So I sincerely apologize in advance in case I said anything/everything wrong). But in my case, the binary collated splitter version is already in production for comma delimeted strings 
And to supplement my earlier post, please read posts from here onwards. I guess both of our top experts Jeff Moden and Paul White already knows it very well?
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Yesterday @ 12:25 PM
Points: 7,110,
Visits: 7,184
|
|
Usman Butt (2/22/2013)
And to supplement my earlier post, please read posts from here onwards. I guess both of our top experts Jeff Moden and Paul White already knows it very well?  Ouch. Less than 6 months ago and I already forgot!
Tom Is minic a gheibheann béal oscailte dorn dúnta. Is minig a cheapas beul fosgailte dòrn dùinte.
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Wednesday, May 22, 2013 3:57 AM
Points: 288,
Visits: 1,903
|
|
| Using a binary comparisons is a good speedup for specific cases and good to be aware of and certainly worth mentioning in bold with its benefits. What it is not however is a good in a generic solution that people can copy paste and directly use without unexpected side-effects. Collations do not exist for nothing and most of the searches in a database will be case insensitve for valid reasons.
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: 2 days ago @ 9:27 AM
Points: 5,618,
Visits: 10,990
|
|
peter-757102 (2/26/2013) Using a binary comparisons is a good speedup for specific cases and good to be aware of and certainly worth mentioning in bold with its benefits. What it is not however is a good in a generic solution that people can copy paste and directly use without unexpected side-effects. Collations do not exist for nothing and most of the searches in a database will be case insensitve for valid reasons.
The collation changes to DS8K suggested by Mister Magoo are all internal to the function and are not inherited by (or retained by) the output columns. Good point though - the output of multiple nested REPLACE accelerated by applying a binary collation will retain the new collation cast and could affect subsequent operations.
“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw
For fast, accurate and documented assistance in answering your questions, please read this article. Understanding and using APPLY, (I) and (II) Paul White Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden Exploring Recursive CTEs by Example Dwain Camps
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Yesterday @ 7:24 PM
Points: 2,346,
Visits: 3,192
|
|
ChrisM@Work (2/26/2013)
peter-757102 (2/26/2013) Using a binary comparisons is a good speedup for specific cases and good to be aware of and certainly worth mentioning in bold with its benefits. What it is not however is a good in a generic solution that people can copy paste and directly use without unexpected side-effects. Collations do not exist for nothing and most of the searches in a database will be case insensitve for valid reasons.The collation changes to DS8K suggested by Mister Magoo are all internal to the function and are not inherited by (or retained by) the output columns. Good point though - the output of multiple nested REPLACE accelerated by applying a binary collation will retain the new collation cast and could affect subsequent operations.
Does this mean though, that internally the BIN collation sequence should be either CS or CI, depending on what the default is for the database?
I always use Latin1_General_BIN and now I'm not sure if that is CS or CI! 
No loops! No CURSORs! No RBAR! Hoo-uh!
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
Need to UNPIVOT? Why not CROSS APPLY VALUES instead? Since random numbers are too important to be left to chance, let's generate some! Are you too recursively challenged? Splitting strings based on patterns can be fast!
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: 2 days ago @ 9:27 AM
Points: 5,618,
Visits: 10,990
|
|
dwain.c (2/26/2013)
ChrisM@Work (2/26/2013)
peter-757102 (2/26/2013) Using a binary comparisons is a good speedup for specific cases and good to be aware of and certainly worth mentioning in bold with its benefits. What it is not however is a good in a generic solution that people can copy paste and directly use without unexpected side-effects. Collations do not exist for nothing and most of the searches in a database will be case insensitve for valid reasons.The collation changes to DS8K suggested by Mister Magoo are all internal to the function and are not inherited by (or retained by) the output columns. Good point though - the output of multiple nested REPLACE accelerated by applying a binary collation will retain the new collation cast and could affect subsequent operations. Does this mean though, that internally the BIN collation sequence should be either CS or CI, depending on what the default is for the database? I always use Latin1_General_BIN and now I'm not sure if that is CS or CI!  
It's neither case nor accent sensitive but there's evidence here that it's smirk-sensitive: Latin1_General_BIN_:s Latin1_General_BIN_:]
“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw
For fast, accurate and documented assistance in answering your questions, please read this article. Understanding and using APPLY, (I) and (II) Paul White Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden Exploring Recursive CTEs by Example Dwain Camps
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Yesterday @ 5:50 PM
Points: 1,308,
Visits: 3,899
|
|
ChrisM@Work (2/26/2013)
dwain.c (2/26/2013)
ChrisM@Work (2/26/2013)
peter-757102 (2/26/2013) Using a binary comparisons is a good speedup for specific cases and good to be aware of and certainly worth mentioning in bold with its benefits. What it is not however is a good in a generic solution that people can copy paste and directly use without unexpected side-effects. Collations do not exist for nothing and most of the searches in a database will be case insensitve for valid reasons.The collation changes to DS8K suggested by Mister Magoo are all internal to the function and are not inherited by (or retained by) the output columns. Good point though - the output of multiple nested REPLACE accelerated by applying a binary collation will retain the new collation cast and could affect subsequent operations. Does this mean though, that internally the BIN collation sequence should be either CS or CI, depending on what the default is for the database? I always use Latin1_General_BIN and now I'm not sure if that is CS or CI!   It's neither case nor accent sensitive but there's evidence here that it's smirk-sensitive: Latin1_General_BIN_:s Latin1_General_BIN_:]
Surely you mean that Latin1_General_BIN is case sensitive (CS) and accent sensitive (AS) ?
Binary collation will definitely find 'a' and 'A' to be different and 'á' to be different to 'a'.
That is part of the reason it is quicker for CHARINDEX and equality testing - it doesn't have to compare 'a' to 'A','á','Á' etc... it is either 'a' or NOT 'a'.
I do agree that it is smirk sensitive though :o) != :O)
MM
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: 2 days ago @ 9:27 AM
Points: 5,618,
Visits: 10,990
|
|
mister.magoo (2/26/2013)
ChrisM@Work (2/26/2013)
dwain.c (2/26/2013)
ChrisM@Work (2/26/2013)
peter-757102 (2/26/2013) Using a binary comparisons is a good speedup for specific cases and good to be aware of and certainly worth mentioning in bold with its benefits. What it is not however is a good in a generic solution that people can copy paste and directly use without unexpected side-effects. Collations do not exist for nothing and most of the searches in a database will be case insensitve for valid reasons.The collation changes to DS8K suggested by Mister Magoo are all internal to the function and are not inherited by (or retained by) the output columns. Good point though - the output of multiple nested REPLACE accelerated by applying a binary collation will retain the new collation cast and could affect subsequent operations. Does this mean though, that internally the BIN collation sequence should be either CS or CI, depending on what the default is for the database? I always use Latin1_General_BIN and now I'm not sure if that is CS or CI!   It's neither case nor accent sensitive but there's evidence here that it's smirk-sensitive: Latin1_General_BIN_:s Latin1_General_BIN_:] Surely you mean that Latin1_General_BIN is case sensitive (CS) and accent sensitive (AS) ? Binary collation will definitely find 'a' and 'A' to be different and 'á' to be different to 'a'. That is part of the reason it is quicker for CHARINDEX and equality testing - it doesn't have to compare 'a' to 'A','á','Á' etc... it is either 'a' or NOT 'a'. I do agree that it is smirk sensitive though :o) != :O)
Oops! Smirk in me eyes yes of course. "binary" is a bit of a giveaway.
“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw
For fast, accurate and documented assistance in answering your questions, please read this article. Understanding and using APPLY, (I) and (II) Paul White Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden Exploring Recursive CTEs by Example Dwain Camps
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Yesterday @ 7:24 PM
Points: 2,346,
Visits: 3,192
|
|
ChrisM@Work (2/26/2013)
mister.magoo (2/26/2013)
ChrisM@Work (2/26/2013)
dwain.c (2/26/2013)
ChrisM@Work (2/26/2013)
peter-757102 (2/26/2013) Using a binary comparisons is a good speedup for specific cases and good to be aware of and certainly worth mentioning in bold with its benefits. What it is not however is a good in a generic solution that people can copy paste and directly use without unexpected side-effects. Collations do not exist for nothing and most of the searches in a database will be case insensitve for valid reasons.The collation changes to DS8K suggested by Mister Magoo are all internal to the function and are not inherited by (or retained by) the output columns. Good point though - the output of multiple nested REPLACE accelerated by applying a binary collation will retain the new collation cast and could affect subsequent operations. Does this mean though, that internally the BIN collation sequence should be either CS or CI, depending on what the default is for the database? I always use Latin1_General_BIN and now I'm not sure if that is CS or CI!   It's neither case nor accent sensitive but there's evidence here that it's smirk-sensitive: Latin1_General_BIN_:s Latin1_General_BIN_:] Surely you mean that Latin1_General_BIN is case sensitive (CS) and accent sensitive (AS) ? Binary collation will definitely find 'a' and 'A' to be different and 'á' to be different to 'a'. That is part of the reason it is quicker for CHARINDEX and equality testing - it doesn't have to compare 'a' to 'A','á','Á' etc... it is either 'a' or NOT 'a'. I do agree that it is smirk sensitive though :o) != :O) Oops! Smirk in me eyes  yes of course. "binary" is a bit of a giveaway.
Doh! (Homer Simpson moment)
No loops! No CURSORs! No RBAR! Hoo-uh!
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
Need to UNPIVOT? Why not CROSS APPLY VALUES instead? Since random numbers are too important to be left to chance, let's generate some! Are you too recursively challenged? Splitting strings based on patterns can be fast!
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: 2 days ago @ 9:27 AM
Points: 5,618,
Visits: 10,990
|
|
dwain.c (2/26/2013)
ChrisM@Work (2/26/2013)
mister.magoo (2/26/2013)
ChrisM@Work (2/26/2013)
dwain.c (2/26/2013)
ChrisM@Work (2/26/2013)
peter-757102 (2/26/2013) Using a binary comparisons is a good speedup for specific cases and good to be aware of and certainly worth mentioning in bold with its benefits. What it is not however is a good in a generic solution that people can copy paste and directly use without unexpected side-effects. Collations do not exist for nothing and most of the searches in a database will be case insensitve for valid reasons.The collation changes to DS8K suggested by Mister Magoo are all internal to the function and are not inherited by (or retained by) the output columns. Good point though - the output of multiple nested REPLACE accelerated by applying a binary collation will retain the new collation cast and could affect subsequent operations. Does this mean though, that internally the BIN collation sequence should be either CS or CI, depending on what the default is for the database? I always use Latin1_General_BIN and now I'm not sure if that is CS or CI!   It's neither case nor accent sensitive but there's evidence here that it's smirk-sensitive: Latin1_General_BIN_:s Latin1_General_BIN_:] Surely you mean that Latin1_General_BIN is case sensitive (CS) and accent sensitive (AS) ? Binary collation will definitely find 'a' and 'A' to be different and 'á' to be different to 'a'. That is part of the reason it is quicker for CHARINDEX and equality testing - it doesn't have to compare 'a' to 'A','á','Á' etc... it is either 'a' or NOT 'a'. I do agree that it is smirk sensitive though :o) != :O) Oops! Smirk in me eyes  yes of course. "binary" is a bit of a giveaway. Doh! (Homer Simpson moment) 
About once a week, mate. Now I'm an old git I can blame it on declining memory. When I was a sprightly youngster it was more embarrassing.
“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw
For fast, accurate and documented assistance in answering your questions, please read this article. Understanding and using APPLY, (I) and (II) Paul White Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden Exploring Recursive CTEs by Example Dwain Camps
|
|
|
|