on 7/22/04 3:54 PM, Justin Swanhart at [EMAIL PROTECTED] wrote:

> MySQL doesn't guarantee that there will be no gaps in sequence values.
>  Assigment of the id is always atomic because innodb uses an AUTO_INC
> lock that lasts for the time of the insert, not the life of the
> transaction.
> 
> lets say your highest order number is 10
> 
> transaction begins for client 1
>   insert into orders (...) values (...)
>   mysql_insert_id = 11
>   ... user adds stuff to order ...
>   aborts order, transaction rolls back
> 
> at the same time
> transaction begins for client 2
>   insert into orders (...) values (...)
>   mysql_insert_id = 12
>   ... adds some stuff ...
>   commits order
> 
> there will be a row with an id of 10 and a row with an id of 12 in
> your database..  id 11 was rolled back and is gone

Ok, so there can be gaps, but there would never be collisions if id's?
-- 
-------------------------------------------------------------
Scott Haneda                                Tel: 415.898.2602
http://www.newgeo.com                       Fax: 313.557.5052
[EMAIL PROTECTED]                            Novato, CA U.S.A.



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to