I was using a SQL function in a Mysql 5.1 server, which took about 1 second to process 70k rows. Now they upgraded the server to 5.5 and the same function is extremely slow.
I’ve tried different data types, with/without DETERMINISTIC or READS SQL DATA, and the improvement, if any, is very small.
I know a SQL function is not the best option when dealing with lots of rows, but it was doing well in the previous installation. Mostly I want to know if they introduced a bug in 5.5 and if it’s a good idea to keep using SQL functions…
Anyone noticed something like this?
This is the function:
CREATE FUNCTION `split_str`(x VARCHAR(255), delim VARCHAR(12), pos INT) RETURNS varchar(50) CHARSET latin1 DETERMINISTIC
BEGIN
RETURN REPLACE(SUBSTRING(SUBSTRING_INDEX(x, delim, pos),
LENGTH(SUBSTRING_INDEX(x, delim, pos -1)) + 1),
delim, '');
END
Have you checked if you have the absolutely latest mysql 5.5.x on that server?
I believe I’ve seen this bug discussed before, but I unfortunatly dont have the mysql bug number available. I think that the issue I remember is fixed in the latest minor version upgrade to the 5.5.x series though.