We can see that our
FORCESCANhint really did make things worse – while we shifted the cost away from the clustered index seek, the sort was actually much worse, even though the estimated costs deemed them relatively equivalent. More importantly, we can see that
STRING_AGG()does offer a performance benefit, whether or not the concatenated strings need to be ordered in a specific way. As with
STRING_SPLIT(), which I looked at back in March, I am quite impressed that this function scales well prior to “v1.”
Given that the early releases tend to be “get the thing working” and later CTPs are around “make the thing faster,” it’s nice to see that STRING_AGG() is already ready for prime-time, and makes me wonder if they’ll make it even faster by RTM.