When executing the attached procedure, mysql hangs up and does not replay anymore until cancelling the task. It is installed locally on a windows machine. Its whole performance is terribly. What to do?
//edit: System information: i7 3GHz, 8GB RAM, Windows 8.
CREATE PROCEDURE fix_lft_rgt_news ()
BEGIN
DECLARE i INT DEFAULT 1;
DECLARE v_char VARCHAR(1);
DECLARE maximumId INT DEFAULT 1;
DECLARE currentId INT DEFAULT 1;
DECLARE currentLft INT DEFAULT 1;
DECLARE categoryLft INT DEFAULT 1;
DECLARE categoryId INT DEFAULT 1;
DECLARE v_parseStr VARCHAR(255) DEFAULT ' ';
SELECT MIN(id) INTO i FROM avsn_assets WHERE name LIKE 'com_content.article%';
SELECT id INTO categoryId FROM avsn_assets WHERE title = 'News' AND name LIKE 'com_content.category%';
SELECT lft INTO categoryLft FROM avsn_assets WHERE title = 'News' AND name LIKE 'com_content.category%';
SELECT MAX(id) INTO maximumId FROM avsn_assets WHERE name LIKE 'com_content.article%';
SET currentLft = categoryId + 1;
WHILE (i <= maximumId ) DO
UPDATE `avsn_assets` SET `lft` = currentLft WHERE `id` = i;
UPDATE `avsn_assets` SET `rgt` = currentLft + 1 WHERE `id` = i;
SET currentLft = currentLft + 2;
SET i = i + 1;
END WHILE;
UPDATE `avsn_assets` SET `rgt` = currentLft + 1 WHERE `id` = cateGoryId;
END;