라벨이 채번테이블인 게시물 표시

mysql, mariadb 채번 방법 또는 auto increment field -> LAST_INSERT_ID의 thread(concurrent) safe 여부

채번할때, last_insert_id 로 select되는 값은 connection basis라는... ** 즉, 해당 connection에서 증가된 값으로 select 된다는... * 단, 같은 connection에서 여러번 insert를 해도 첫번째 insert시 증가한 auto_increment 값만 select한다는.... ** commit 시점이 중요한듯(?) from : https://dev.mysql.com/doc/refman/5.0/en//information-functions.html#function_last-insert-id The ID that was generated is maintained in the server on a per-connection basis. This means that the value returned by the function to a given client is the first AUTO_INCREMENT value generated for most recent statement affecting an AUTO_INCREMENT column by that client. This value cannot be affected by other clients, even if they generate AUTO_INCREMENT values of their own. This behavior ensures that each client can retrieve its own ID without concern for the activity of other clients, and without the need for locks or transactions. The value of LAST_INSERT_ID() is not changed if you set the AUTO_INCREMENT column of a row to a non-“magic” value (that is, a value that is not NULL and no...