4 messages in com.mysql.lists.win32RE: last_insert_id()
FromSent OnAttachments
Brian Dietrich02 Dec 1999 23:00 
Paul DuBois03 Dec 1999 04:45 
Brian Dietrich03 Dec 1999 12:27 
Paul DuBois03 Dec 1999 12:31 
Subject:RE: last_insert_id()
From:Paul DuBois (pa@snake.net)
Date:12/03/1999 12:31:12 PM
List:com.mysql.lists.win32

At 2:27 PM -0600 12/3/99, Brian Dietrich wrote:

the autoincrement stays unique across clients--correct?

Correct.

-----Original Message----- From: Paul DuBois [mailto:pa@snake.net] Sent: Friday, December 03, 1999 6:46 AM To: Brian Dietrich; win@lists.mysql.com Subject: Re: last_insert_id()

At 1:00 AM -0600 12/3/99, Brian Dietrich wrote:

Hello. I was hoping someone could answer my question regarding the last_insert_id in MySql. I am using autoincrement and I insert a row in one statement. The next statement is a select using last_insert_id to obtain the autoincrement id. I think this is a bad idea in a high-volume transactional system--or does MySql control this through the connection thread. That is, I am worried about pulling back someone elses id in my last_insert_id select--someone who did an insert between the time I issued my insert and my select on last id. Do I need to worry about this? I looked at locking, but that does not appear to be a pretty option. Any help would be greatly appreciated.

The last insert id is maintained on a per-client basis. You cannot get someone else's id.