El 04/05/12 06:36, Vineet Deodhar escribió: >> On 5/3/12 9:06 PM, Vineet Deodhar wrote: >>> Isn't it dangerous to get a pkid from the db before commit? >>> Consider a situation where UserA gets a pkid "2564' for a table "tbl1". >>> Before this change is committed, UserB inserts a record to tbl1& gets >>> "2564". >>> >>> Wouldn't is cause a mess? > > >> No, postgres knows it handed out 2564 already, even though it isn't >> committed yet. >> >> Paul >> >> > I see. > > In that case, it would lead to further trouble such as --> > UserA, after getting pkid 2564 for tbl1, cancels the addition. > So 5264 is unutilized. > > If the no. of users & data-traffic is quite low, no issue. > But consider a case where hundreds of users are interacting with tbl1 and > there are a lot of cases for cancelled additions to tbl1. > > In effect, even if the smallint data-type for this pkid is sufficient, the > DBA has to opt for maybe mediumint ! > > Anyway, I am using MySQL and I am very much comfortable with it. > > -- Vineet >
I'd never use smallint or mediumint for a pkid! If the table is small enough then you are not saving much space. If it is big then it will not scale properly. I guess RDBMs define pkid type according to maximum database size in records, and then some in order to have ample space to cover for what you specify. _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/[email protected]
