Jordan,
Ok. I was thinking doing join on SQL would be significantly less costly - 
but after reading your insights I think that doing the join ourselves will 
not be significantly slow. Thanks for this insight.

-
Suresh

On Friday, 16 June 2017 01:00:15 UTC+5:30, Jordan (Cloud Platform Support) 
wrote:
>
> You are correct, performing the two separate queries is the correct way of 
> retrieving the Post entities made by the authors who are followed by 
> current_user. 
>
> A JOIN operation is actually the same thing, just in SQL syntax. The first 
> step would be to JOIN all 'Post' entities with 'Following' entities where 
> 'author' is equal. This would then produce a new table containing combined 
> rows of the two kinds on 'author'. Once you have the JOINed result, you 
> would then perform another query for all 'followed_by' equal to 
> 'current_user', and you would get your Posts.
>
> So you can see how your current implementation is the most optimized. If 
> anything, you could do a projection query 
> <https://cloud.google.com/appengine/docs/standard/java/datastore/projectionqueries>
>  on 
> the first Following query to only receive the list of 'author's IDs instead 
> of the entire Following objects. This would save you a bit of networking 
> time and costs.  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/99b2710f-d9bd-4c83-8ad9-b813c0a43fd1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to