Hi, actually I think you and Martin are on the same page, more or less. The size of the table you suggest is kind of scary (think 10 million users, each with 50 friends, each having read 50 books = 25 billion rows) And if super-star user who has been befriended a million times reads a book, thats a million rows that need to be added at the click of a button).
And Im not even sure if it is technically possible for datastore. This table has two multi-valued properties for filtering: tags (0-4) and friends (0-?) and a property for sorting (numfriends). So I guess it needs some kind of composite index across those three properties, which, to keep from exploding, would have to have friends capped in the hundreds. can anyone confirm that, or is ti technically impossible for other reasons ? cheers On Jul 8, 2:20 pm, Stephen Johnson <onepagewo...@gmail.com> wrote: > Personally, I would try attacking this problem from a different > direction. I'm assuming that if Sally is John's friend then John is > also Sally's friend. So, let's suppose that Sally (key S1) reads the > book Great Expectations (key E1) and has friends John (key J1) and > Mike (key M1). I would add a table that looks something like: > > userKey > tag > bookKey > numFriends > friendsList > > and add an index on userKey, tag, bookKey, numFriends > > So, when Sally indicates she has read Great Expectations (E1). I would > add (or modify if entries for these users/book combinations already > exist) two entries to this table (one entry for each of her friends), > so it would look like: > > userKey tag bookKey numFriends friendsList > --------------------------------------------------------------- > J1 historical+drama E1 1 Sally > M1 historical+drama M1 1 Sally > > Now let's say Ken (K1) is a friend of John's but not Mike's and he > reads Great Expections, so table would look like: > > userKey tag bookKey numFriends friendsList > --------------------------------------------------------------- > J1 historical+drama E1 2 S1,K1 > M1 historical+drama M1 1 S1 > > And finally, let's say Betty (B1) is a friend of Johns and reads Moby > Dick (D1) so table would be: > > userKey tag bookKey numFriends friendsList > --------------------------------------------------------------- > J1 historical+drama E1 2 S1,K1 > J1 historical+drama D1 1 B1 > M1 historical+drama M1 1 S1 > > Now, querying this table should be fast and efficient along with > sorted properly. > > Well, this is the way I'd do it. Hope it helps. > Steve -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appeng...@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.