On Mon Oct 18, 2004 at 13:12:59 +1000, Michael Kraus wrote: > >No, this definetly opens up race conditions and lots of rollbacks and >reprocessing. > >Eg (in pseudocode). > >id =3D execute("SELECT MAX(id) FROM tablename") + 1; >... >result =3D execute("INSERT INTO tablename VALUE(id, ....)"); >if (!result) { rollback(); repeat(); } >---- > >Either that or it would cause the database performance to slow down >whilst it holds a that table. Better just to have another unique >identifier in my reckoning.
No, not max(id). I'm talking from postgres, but you don't select max(id), you use a sequence to get the next index and then use that to insert. It seems like Glen came up with the way to do it in MySQL. Benno -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html