[![enter image description here](https://i.stack.imgur.com/InGFr.png)](https://i.stack.imgur.com/InGFr.png)

trx1
select \* from table where refId=4 for update

trx2
insert into table (refId) values (2); block

trx2 will be blocked, i knew trx1 will keep it gap lock, [1,4),[4,7);

my question is why keep gap lock? "insert val 2" is not conflict "select where refId=4 for update", why innodb will keep gap lock, why not use record-lock?

this question has been bothering me for a long time, please tech god save me.