If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Multithreaded Application Insert Puzzle

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-21-07, 19:43
Toum Toum is offline
Registered User
 
Join Date: Nov 2003
Posts: 4
Multithreaded Application Insert Puzzle

I have multiple concurrent processes inserting records in a table having a unique primary key. The isolation level is READ COMMITED (with InnoDB). Two processes could do an INSERT of the same primary key exactly at the same time.

Question 1)

Does MYSQL Server accept one INSERT and raise DUPLICATE KEY error for the other one ? Or, are the two records rejected ?

Question 2)

Is the duplicate key error checked at the end of the INSERT statement or at the end of the transaction (COMMIT) ?

Question 3)

A last and dummy one ! Sorry about that.

Does the database server always PHYSICALLY execute 1 (and only 1) modify statement (UPDPATE,INSERT,DELETE) at once, even at user level programmer is thinking in terms of concurrent statements ?

Thanks for any help.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On