I would be extremely surprised if tableupdate() didn't do a behind the scenes lock/unlock cycle. Have a look at MSDN "Buffering Data":
http://msdn.microsoft.com/en-us/library/aa975707%28v=vs.71%29.aspx On Sat, Aug 25, 2012 at 6:31 PM, Frank Cazabon <[email protected]>wrote: > This is the process: > > Seek the record in the next id table that you want. Lock it. Replace the > next id with next id plus one. Unlock. Now you do your insert in whatever > other table. Hopefully you are using table buffering so you do not have to > lock the other table, just do an if tableupdate(). > > Your example locked the table, incremented the id, did the insert and then > unlocked. By removing the insert from the code the time involved is less. > > Also if you have a million record table, the select max () +1 will probably > be slower than the seek in a small table, even with the appropriate index. > > On 25 Aug 2012 18:02, "Lew Schwartz" <[email protected]> wrote: > > Not sure if I agree with you, Frank. You are still going to have contention > using the separate table method. It'll just be in a different place. Also, > max()+1 will be highly optiimized because it'll be supported by an integer > index on the pk. You've got to lock/unlock and update 2 separate tables for > every operation. > > On Sat, Aug 25, 2012 at 5:33 PM, Frank Cazabon <[email protected] > >wrote: > > > > No, if you do the flock, then you won't get duplicates. But you should > only > > try to lock records... > > text/plain (text body -- kept) > > text/html > > --- > > > [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/cafuu78egqruof9rjtshv87xr7gr3oatrfqrrbjwtnsxxglz...@mail.gmail.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

