Yannick, 

Could you please point out why the reference to query best practices when 
the query is clearly defined above. It's a simple page fetch with two 
conditions, and as described is taking 2 seconds on average to fetch 250 
results and 4 seconds for 550 results on the live version...

At the moment after the first time these are fetched I'm placing the 
results in memcache for subsequent calls. However, I am using the free 
memcache as the data size does not warrant the price for the minimum of 1 
gig fixed memcache, and the free memcache is not guaranteed so there are 
times when I have to resort to the query. As it is, these times are 
unacceptable and will surely be a bigger problem when data sizes grow. I 
will of course resort to aync calls when each fetch reaches 1000, I'll 
split those into 100 batches, but still why is it so slow for even 250 
results?

If I can understand why this is occurring then I can try to figure out a 
way around it, maybe it is a bottleneck in the way my model is formed, it's 
size of something else. However, if I am simply querying on the two 
entities as above, why would that effect it?

Thanks


On Thursday, August 31, 2017 at 11:53:41 PM UTC+3, Yannick (Cloud Platform 
Support) wrote:
>
> Hello Richard, since you're not mentioning it could you tell us whether or 
> not you've defined indexes for this specific query?  There's also no 
> indication of how large these entities are. Do you get the same issues for 
> other kind of entities? 
>
> You should read through the queries best practices 
> <https://cloud.google.com/datastore/docs/best-practices#queries> and make 
> sure you're following them all.
>
> On Thursday, August 31, 2017 at 4:31:20 AM UTC-4, Richard Cheesmar wrote:
>>
>> The following query seems to take an way too long
>>     
>>     
>> t0 = time.time()
>>     
>>     # Fetch the entities and return result with cursor
>>     result, next_cursor, more = MyModel.query(MyModel.active == True, 
>> MyModel.offline == False).fetch_page(pagination, start_cursor=cursor)
>>     
>>     logging.info(time.time() - t0)
>>
>>
>>
>> On the local development machine it takes nearly 2 seconds and there are 
>> less than 150 entities in the model
>>
>> When live with around 800 entities it takes nearly 2 seconds to retrieve 
>> the first 250 entities and then around 4 seconds to retrieve the 
>> remainder. There are two separate requests to retrieve each set on the 
>> live machine. 
>>
>> I've set the time on the query only, therefore no other processing is 
>> taken into account in these timings.
>>
>>
>> Enter code here...
>>
>>
>>
>>
>>
>>

-- 
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 https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/43c27435-5233-41ed-8fa2-dcfd16f0d11d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to