The reference Manual says above function returns the first auto generated value for an auto incrementing column.

I have a database with a few tables. Now, there is a table "TABLE 1", the PK of which i use as FK in other tables.

Now, My worry is, How do i handle this situation?

I tried using LAST_INSERT_ID() that also did not help(no table or DB lock used). The data got corrupted.

Suppose the AI id for one req was 6. Before the application could make a call to get the ID, other request was executed and the AI id returned was not correct.

Now, the only option left out is to lock the table or DB and do the processing and thts how I can proceed.

Just wanted to know if there is som other way to do this.

Also, what lock should i Use table lock or DB lock? and approx. how much of a performance hit would it be?

Other points to remeber:
There are possibilities of simultaneous hits.
This app needs to sclable. At any given point of time, around 100 users would be online.