Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Selecting (max) OR identity field
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
SaraC  
View profile  
 More options Jun 8 2010, 11:50 am
From: SaraC <sarajchi...@gmail.com>
Date: Tue, 8 Jun 2010 08:50:00 -0700 (PDT)
Subject: Re: Selecting (max) OR identity field
The problem is this application is a url shortener and requires an
identifier that can be hashed and
used for those purposes. I don't know of another solution while
ensuring uniqueness.

On Jun 8, 2:49 am, Ken Egozi <egoz...@gmail.com> wrote:

> select MAX is definitely wrong for the reasons mentioned.
> I would avoid Identity behaviour anyway, and not only because of the
> sharding issue. Using Identity means that every Insert must immediately call
> the database. This is not always desirable, as you might want to do more
> stuff with the Id, but postpone the DB call for later for various reasons.

> Now using the ObjectId approach has its limitations also, mainly the size
> and the readability, as some systems like human readable ids (order number,
> user id, customer service call id, etc.)
> you can enjoy both worlds if you employ the hi-lo algorithm (or
> a variation thereof). You get an integer id, generally sequential, fast to
> generate and simple to implement.

> The docs for Hibernate/NHibernate are all full with reasons to avoid
> Identity and use GuidComb (their equivalence of ObjectId) or HiLo

> On Tue, Jun 8, 2010 at 9:35 AM, Jørn Wildt <j...@fjeldgruppen.dk> wrote:
> > Check this request for some thoughts:
> >http://jira.mongodb.org/browse/SERVER-195

> > Beware of concurrency issues: two reades may read MAX() = 10 and then
> > both of them increment it to 11. You need to use MongoDB's various
> > atomic operation to ensure this operation is safe.

> > /Jørn

> > On Jun 8, 8:19 am, SaraC <sarajchi...@gmail.com> wrote:
> > > I'm new to NoSQL, I'm looking to either create an identity field (that
> > > starts at 0) or build my own by selecting a max value.

> > > I understand that the Mongo Ids are timestamps and can be used as
> > > such. However, I need a smaller value for this column.

> > > Thanks a bunch!

> > --
> > You received this message because you are subscribed to the Google Groups
> > "NoRM mongodb" group.
> > To post to this group, send email to norm-mongodb@googlegroups.com.
> > To unsubscribe from this group, send email to
> > norm-mongodb+unsubscribe@googlegroups.com<norm-mongodb%2Bunsubscribe@google groups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/norm-mongodb?hl=en.

> --
> Ken Egozi.http://www.kenegozi.com/bloghttp://www.delver.comhttp://www.musicglue... הכנס הקהילתי הראשון למפתחי דוטנט - בואו בהמוניכם


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.