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 or tables for the minimum time necessary. So using a > separate table, locking the record, incrementing it and unlocking should be > faster than your example and result in less contention for the lock > > On 25 Aug 2012 12:31, "Lew Schwartz" <[email protected]> wrote: > > Getting back to max()+1 and ignoring one sided b-tree & dirty buffer > issues, are you guys telling me that: > > > flock(mytable) > > select max()+1 as idno into temp > > insert values (,,temp.idno) > > blah, blah ... > > unlock > > Won't reliably produce unique idno's. (I don't have a network avail to > test this out myself). > > > > --- StripMime Report -- processed MIME parts --- > multipart/alternative > text/plain (text body -- ... > > _______________________________________________ > Post Messages to: [email protected] > Subscription Main... > This message: > > http://leafe.com/archives/byMID/profox/cafuu78fhtwfjto9h9exzxai-lsstxkxjbsgtjaxesmwcuux...@mail.gmail.com > > ** All postings, unless explicitly stated otherwise, are the opinions of > the author, and do not cons... > Report [OT] Abuse: > > http://leafe.com/reportAbuse/cafuu78fhtwfjto9h9exzxai-lsstxkxjbsgtjaxesmwcuux...@mail.gmail.com > > > --- StripMime Report -- processed MIME parts --- > multipart/alternative > 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/cafuu78eyaeduupsepylq6ypq3moywdv4onag-st4xujxwlf...@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.

