Re: PK Generation in MySQL
Re: PK Generation in MySQL
- Subject: Re: PK Generation in MySQL
- From: Robert Walker <email@hidden>
- Date: Thu, 18 May 2006 14:24:09 -0400
Randy,
Generally PK generation is a function EOF not MySQL. There are plug-ins that support database native PK generation, as is the case with "OpenBasePKPlugIn." but I'm not aware of anything similar for MySQL.
In any case, unless you're using something special, this problem likely has nothing to do with MySQL. The problem would exist no matter what data store is used.
This may have something to do with the batched PK generation used by EOF, or improper use of locking on your EOEditingContexts. Is it absolutely necessary to multi-thread your inserts? If you're expecting better performance from MySQL, I don't think you'll get what you expect. MySQL will just queue up the inserts and do them in sequence anyway. At least this is my experience with MySQL. In fact we had to go to OpenBase for a project just because MySQL insert/update performance was abysmal. OpenBase performed at least 10x faster than MySQL on insert/update.
Also, it's my understanding that EOF is not threaded anyway. Could be wrong on this point. On May 18, 2006, at 1:50 PM, Randy Wigginton wrote: This seems like a surprisingly obvious bug, so I figured I’d better ask what I’m doing wrong. I have some code that writes records to a MySQL DB. The PK is a simple INT, and the field is the only one the record locks on. Everything works fine in a single thread… but when I start a second thread writing to the table, sooner or later one thread gets a “duplicate entry ‘187451’ for key 1.” Do I need to do something special for MySQL to get PK generation working correctly? |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden