On Tue, Jan 20, 2004 at 01:25:34PM +0100, Tobias Asplund wrote: > On Tue, 20 Jan 2004, Marco Paci wrote: > > > Since the process of inserting a new record and reading its PK field > > value is a two step process implemented by: > > 1) insert into tablename (columnnames) values(....) > > 2) select last_insert_id() > > ,and since because of the architecture of my application I cannot > > prevent that 2 concurrent insertions won't be done > > http://www.mysql.com/doc/en/LOCK_TABLES.html > > What will happen is: > > | Write-lock on table > | Insert a new record > | Write-lock on table (waiting...) > | > | Read the value of PK field > | Unlocking table(s) > | Write-lock gotten > | Insert new record > | Read the value of PK field > | Unlock table(s) > | > | > | > v > Time Thread 1 Thread 2 > Axis
Ignore this. There's no locking needed to call last_insert_id(); read my other post. Balazs -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]