Hi Giacecco, Datastore IDs are 64bit integers.
-Nick Johnson On Wed, Jul 28, 2010 at 8:58 AM, Giacecco <[email protected]> wrote: > Thanks for your answer. I know that the numeric ID comes "for free" on > the side of the db.key key, that is the king. I also know that IDs are > unique only across entities with the same parent, which is compatible > with what I need to do. > > I still lack that information I originally asked for, though. Imagine > I was writing a Bit.ly clone, with 6 letter short URLs over a set of > RFC-1738 allowed characters, that is made of 74 case-sensitive > characters. The total number of short URLs I can have is Math.pow(74, > 6) = 164,206,490,176 . > > If I knew that numeric IDs were made of unconstrained 64 bit integers, > I would be ok. But if it's 32 bit integers, than it's not enough (max > is Math.pow(2, 32) - 1 = 4,294,967,295, unsigned). > > I would also like to be able to do the reverse calculation. E.g. if > the max table size in the datastore is as big as a 64 bit integer > gets, what's the longest short URL I can support? It's > Math.log(Math.pow(2, 64)) / Math.log(74) = 10 ... > > How do I know that a datastore table can get to that size, and how > numeric IDs will look like? > > Thanks! > > Giacecco > > > On Jul 28, 12:57 am, Geoffrey Spear <[email protected]> wrote: > > db.Key is the type of the key, not the numeric ID; the ID is an > > integer. I believe they're limited to 64 bits, the same as an > > IntegerProperty. > > > > Note that a key isn't required to have a numeric ID; it could have a > > key name instead. And IDs aren't unique across the datastore; only > > within a Kind for entities with the same parent. > > > > On Jul 27, 4:15 pm, Giacecco <[email protected]> wrote: > > > > > > > > > Dear all, I have searched the answer to this in the group and in the > > > FAQ but was not successful, although it seems quite a trivial > > > question: what's the max numeric id I could find in the datastore if I > > > kept adding data to it? > > > > > I need to base part of my algorithms on the key numeric value, so I > > > need to know what I can expect from it: min, max values etc.. The > > > documentation says that it is of type "db.key" but nothing more than > > > that. And, even knowing its type, are there any logic constraints to > > > its value that I should know about? > > > > > Am I missing something perhaps? > > > > > Thanks! > > > > > Giacecco > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-appengine%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > > -- Nick Johnson, Developer Programs Engineer, App Engine Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: 368047 Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: 368047 -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
