Skip to content
Advertisement

Column concatenation in Order by expression. Is it wrong?

What are pros and cons whether I use Order by expression like this:

or in this way:

How each one does impact on performance?

Advertisement

Answer

The concatenation is unnecessary and may produce incorrect results. For instance, consider these values:

The concatenation will put the first row first. By individual keys, it will put the second one first.

It can slow down the order by, if the order by can make use of indexes.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement