String_Split Performance

Kevin Feasel

2016-03-21

T-SQL

Aaron Bertrand looks into how STRING_SPLIT performs compared to other string splitting methods:

So with those limitations out in the open, we can move on to some performance testing. Given Microsoft’s track record with built-in functions that leverage CLR under the covers (coughFORMAT() cough), I was skeptical about whether this new function could come close to the fastest methods I’d tested to date.

Let’s use string splitters to separate comma-separated strings of numbers, this way our new friend JSON can come along and play too. And we’ll say that no list can exceed 8,000 characters, so no MAX types are required, and since they’re numbers, we don’t have to deal with anything exotic like Unicode.

The results are surprising.  I expected it to be somewhere around CLR-level, but not way better.

Related Posts

Matrix Transposition In T-SQL

Phil Factor has some fun transposing a matrix using T-SQL: What I’m doing is simply converting the table into its JSON form, and then using this to create a table using the multi-row VALUES  syntax which paradoxically allows expressions. The expression I’m using is JSON_Value, which allows me do effectively dictate the source within the table, via […]

Read More

Joins And Parentheses

Shane O’Neill walks through different ways of grouping tables in a SQL query: Asker: that’d be awesome if i can inner join two other tables instead of the table mentioned after FROM keyword Me: …wait, what? A: He’s asking t1 left join t12 t1 left join t13 t12 inner join t13 M: em…it’s possible but it’s…iffy […]

Read More

Categories

March 2016
MTWTFSS
« Feb Apr »
 123456
78910111213
14151617181920
21222324252627
28293031