And this would probably also answer this question:
"Very low limit on #values in index for an entity?"
http://groups.google.com/group/google-appengine/browse_thread/thread/4691b88ff64c3a3e/83f8f48e49c3c7e1?lnk=gst
<http://groups.google.com/group/google-appengine/browse_thread/thread/4691b88ff64c3a3e/83f8f48e49c3c7e1?lnk=gst>which
I was holding my breath to get answered.

2010/4/12 Jaroslav Záruba <[email protected]>

> Is it a good idea to create the "friends" field as a collection? My
> understanding was that "property with multiple values", how collections are
> usually referred to in the documentation, have crucial effect on index
> size(s). And here we would have quite large amount of quite large
> collections.
> I'm not saying it is a bad concept, I'm still trying to understand this
> myself.
>
> With classic type of db I would suggest some kind of separate entity named
> FriendsXRef or FriendsRel, but given that DataStore does not support joins I
> don't know how to solve this quite common scenario without hitting some
> index-size related limit. :(
>
> I'm really curious about this, so if anyone could explain this to me,
> please...?
>
>
> On Mon, Apr 12, 2010 at 1:10 AM, Waleed Abdulla <[email protected]> wrote:
>
>> You're on the right track.
>>
>>
>> class User(db.Model):
>>   uid = db.IntegerProperty()
>>   score = db.IntegerProperty()
>>   friends = db.ListProperty(int)
>>
>> 1. Global high score.
>>     select * from User order by score desc
>>
>> 2. Friend's high score
>>
>> select * from User where friends = <user id here> order by score desc
>>
>> This works if you have an index on friends and score (desc). And because
>> the uid of the user in question will be in the list of "friends" of all his
>> friends, so basically the condition of friends = uid will limit the result
>> to the friends of that user. The only missing component here is that the
>> user himself won't be in the list. You can get around that by either adding
>> the user id to the friends list (i.e. a user is a friend of himself) or by
>> getting the results for the friends and then inserting the score of the
>> user programmatically.
>>
>> Waleed
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Sun, Apr 11, 2010 at 3:01 AM, Herbert <[email protected]> wrote:
>>
>>> hi all,
>>>
>>> suppose i have a network of 100k users, each of them have 100 friends.
>>> they're all playing some games and have scores , i want to do two
>>> rankings: 1. global ranking, 2. ranking of friends. how am i going to
>>> design my datastore for this?
>>>
>>> can i do something like this?
>>>
>>> class User(db.Model):
>>>   uid = db.IntegerProperty()
>>>   score = db.IntegerProperty()
>>>   friends = db.ListProperty(int)
>>>
>>> since we don't have join, i'm thining of putting ids of friends in a
>>> listProperty like above, learning from a GAE presentation that
>>> listproperty gets inefficient at (or limited to) 1k entries, which i
>>> think it's more than enough for my app.
>>>
>>> i think it's question of best practices for designing entities for GAE
>>> without JOIN, yet i couldn't seem to find a discussion that nails what
>>> i'm looking for. would be grateful if anyone could share some
>>> thoughts.
>>>
>>> the appengine's been great! thanks all GAE team!
>>>
>>> Herbert
>>>
>>> --
>>> 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.
>>>
>>>
>>  --
>> 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.
>>
>
>

-- 
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.

Reply via email to