Pergunta

I am working on online trading project.
I insert one row on table t1 (innoDB engine) and there is one trigger on after insert event.
In trigger, i fetch data using select statement in same table like "SELECT * FROM t1 WHERE ID = NEW.ID".
It works perfectly 2-3 months. but now it gives Deadlock issue.
what is reason behind it ?
is it possible while multiple thread access same operation on same table at a time ?

Foi útil?

Solução

do you want the id that you have inserted before ?

you can try something like this

INSERT INTO table1 (title,userid) VALUES ('test', 1); 
SET @last_id_in_table1 = LAST_INSERT_ID();
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top