views:

47

answers:

2

how is this possible

first i do insert into table2 select * from table1 where table1.id=1 ( 50k records should be moved 6 indexes has to be updated )

second delete from table1 where id=1 ( 50k records are removed )

How is it possible that only 45k of records are moved?

Im scratching my head over this and cant find a right answer Is it possible that the insert is still active and delete already started

A: 

why dont you just call a stored procedure - would be much cleaner !

delimiter ;
drop procedure if exists move_data;

delimiter #
create procedure move_data
(
  in p_table_id int unsigned
)
begin
  set autocommit = 0;
  insert into table2 select * from table1 where table1.id = p_table_id;
  delete from table1 where id = p_table_id;
  commit;       
end #

delimiter ;

call move_data(1);  
f00
i could do that but that still doesnt explain what happened
Grumpy
A: 

soap in my eyes, not slept well. Wanna thank you all for your effort.

Grumpy
So what is the answer then? You can provide your own answer and accept it - maybe it helps someone in the future. And maybe that someone will be yourself :)
Konerak
is was a complete coding mistake.
Grumpy