SUBSTRING_INDEX vs MID+INSTR
I wanted to pull from domain name out of an email (or just remove the username part of an email).
There are two simple functions (and even more...) to do it:
use built in function SUBSTRING_INDEX to explode the string by '@' and get the last element.
But which one of them have better performance?
Using BENCHMARK function for Measuring the Speed of Expressions and Functions.
/* Affected rows: 0 Found rows: 1 Warnings: 0 Duration for 1 query: 12.625 sec. */
/* Affected rows: 0 Found rows: 1 Warnings: 0 Duration for 1 query: 19.157 sec. */
BENCHMARK function results may vary between different devices, but on the same device can give quite clear results.