Quantcast
Channel: MySQL Forums - InnoDB
Viewing all articles
Browse latest Browse all 1954

Insert deadlock HUGE DELAYS?? (1 reply)

$
0
0
I am running a simple recursive loop. For some reason the insert is causing a deadlock issue. How can I avoid this. I tried the Delay hint, but nothing is working. Any suggestions would be greatly appreciated!!
 CREATE procedure recursive()
    BEGIN    
    START TRANSACTION;
set @a := 1;
insert into CteTree(personid,tallerpersonid,TallPath,depth)
select  m.shorterpersonid
            ,m.tallerpersonid
            ,'test'		
            ,0
		FROM	map AS m
    ;
   
    WHILE row_count() > 0  do
    set @a := @a+1;
    insert into CteTree(personid,tallerpersonid,TallPath,depth)
    SELECT		m.ShorterPersonID
                ,m.tallerpersonid
 	        ,'test'
				,@a
		FROM		CteTree AS t
		INNER JOIN	map AS m 
        ON m.TallerPersonID = t.PersonID
        where t.depth = @a - 1;        
    end while;
commit;
end;

Viewing all articles
Browse latest Browse all 1954

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>