The problem of transaction blocking caused by database foreign key constraints

The

database has two tables for students and classes, and the field classId in the student table is associated with the field id in the class table.

clipboard.png
clipboard.png

in a transaction, I first changed the classId of student2 in the student table to 1, and then went to the class table to query the information of class2 according to id=2. At this time, blocking occurred, the query result could not be returned, and the whole transaction could not be executed. I think it should have something to do with foreign key constraints. do any bosses know the specific reasons?

Jul.04,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3d79b-34762.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3d79b-34762.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?