One option is to use sequences instead, so you yourself create an identifier before you insert.
Unfortunately, they are not supported in MySQL, but libraries like Adodb can mimic them using a different table. I think, however, that the emulation itself will use lastInsertId () or equivalent ... but at least you are less likely to have a trigger in a table that is used exclusively for sequence
Tom haigh
source share