Hello! I am having so much trouble understanding datastore queries!
This is my problem.
I can't seem to figure out whether querying from the top of a tree down to 
a end node is faster than querying through all end nodes.
I don't care about write cost or about transactions, I just want to know 
what would be faster.

Here is an example of what I mean.
Lets say I have stored all the restaurants in a country through a database 
hierarchy.
Level 0 is the world.
Level 1 are the countries.
Level 2 are the states.
Level 3 are the cities
Level 4 are the restaurants

Now my users want to search for information about a particular restaurant 
and give me the country state city and restaurant name.

Would it be faster for me to save the country, state, city and restaurant 
at level 4 and then query through all restaurants for a match? OR
Would it be faster for me to search the country for all children states, 
pick the state I want, search the state for cities, pick the city I want, 
and essentially narrow it down to the restaurant?

Because I feel that with option one, I would end up linearly increasing the 
time my requests take and that's just not good.
And with option two, it feels like I would end up having to run multiple 
queries to find all the children of each level and then pick the child I 
want. Do I really need to run that many queries?

A perfect solution for me would be one query that allows me to search 
through the tree and get to the node I want. Is that possible?

Please respond even if I am unclear, I will appreciate literally any help 
you can give me.


-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/53f50729-b705-4a6a-a02e-279504dfbfba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to