Is this the correct way to generate id in MySQL?
INSERT IN PHOTO (PictureId, First_pick, name, description, File_Name, Is_Vertical) VALUES
((SELECT max (pictureid) +1 FROM Picture), 0,?,?,?,?)
I mean, if this ensures that the PictureId will be unique when this request is launched by many threads?
I can not change the structure of the table. Should I use any specific locks, index level or transaction isolation level?
Regards, Michal
source
share