Hi, I have an app with two entities that need (maybe) to interrelate in the typical sql join sense.
Users --------- userId Long Matches initiatingUserId Long attemptingUserId Long matched boolean >From my UI I can get the data populated properly but I end up with this in one row: initiatingUserId = 1 attempingUserId = 2 matched = true What I want is when user 1 goes to this section of the app, to get a list of all records with matched = true, where the currently logged in user is in EITHER initiatingUserId OR attemptingUserId. This can't be done in the sql sense using a logical OR, since that's not supported in the datastore since it doesn't perform well. Of course I can do two queries and join the dataset, but this introduces some serious pain in the workaround regarding paging on a large dataset. Not to mention two queries per request just sounds slow/wrong. I watched the excellent video from google IO 2009 that instructs us to think of these things as "group membership queries", and to do "venn diagram self joins". So I was thinking the solution may be to remodel the entities like so: - Remove the Matches entity completely - change the Users entity to this: Users: --------- List<int> initiatingUserIds List<Int> attemptingUserIds I'm struggling to write the query that would then retrieve this data. Anyone have any ideas on this design? Thanks a bunch! David --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
