Skip navigation links

MySQL Forums :: Performance :: Hanging on copying to tmp table


Advanced Search

Re: Hanging on copying to tmp table
Posted by: Brian Dalby ()
Date: April 26, 2012 02:17AM

I am really confused by this, right now I am thinking of doing a "dirty" trick, inspired by this: http://forge.mysql.com/tools/tool.php?id=106

DELIMITER $$
CREATE PROCEDURE `kill_run_aways` ( IN runtime TINYINT UNSIGNED )
LANGUAGE SQL
NOT DETERMINISTIC
BEGIN
DECLARE done INT DEFAULT 0;
DECLARE ConnectionId INT UNSIGNED;
DECLARE ConnectionCursor CURSOR FOR SELECT ID FROM information_schema.PROCESSLIST
WHERE USER LIKE 'SPECIFIC_USER'
AND (COMMAND IN ('Query','Copying to tmp table'))
AND TIME >= runtime;

DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;

OPEN ConnectionCursor;

REPEAT
FETCH ConnectionCursor INTO ConnectionId;
IF NOT done THEN
KILL ConnectionId;
END IF;
UNTIL done END REPEAT;
CLOSE ConnectionCursor;
END$$
DELIMITER ;

SET GLOBAL event_scheduler = ON;

CREATE EVENT IF NOT EXISTS `kill_run_aways`
ON SCHEDULE EVERY 2 SECOND
ON COMPLETION PRESERVE ENABLE
DO CALL kill_run_aways(60)
/* Change schedule and runtime for your needs */;

That is not a nice way to do it, but it might solve the problem right now.

Options: ReplyQuote


Subject Views Written By Posted
Hanging on copying to tmp table 3712 Brian Dalby 04/23/2012 06:55AM
Re: Hanging on copying to tmp table 2048 Rick James 04/24/2012 10:16AM
Re: Hanging on copying to tmp table 1497 Brian Dalby 04/24/2012 02:44PM
Re: Hanging on copying to tmp table 1395 Brian Dalby 04/25/2012 01:08PM
Re: Hanging on copying to tmp table 1334 Rick James 04/25/2012 08:43PM
Re: Hanging on copying to tmp table 1342 Brian Dalby 04/26/2012 12:35AM
Re: Hanging on copying to tmp table 1552 Brian Dalby 04/26/2012 02:17AM
Re: Hanging on copying to tmp table 1323 Seweryn Ożóg 04/26/2012 03:28PM
Re: Hanging on copying to tmp table 1034 Brian Dalby 04/27/2012 07:02AM
Re: Hanging on copying to tmp table 1231 Rick James 04/28/2012 01:37PM
Re: Hanging on copying to tmp table 1262 Brian Dalby 04/28/2012 02:00PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.