Reread the GAE Query documentation.
Your use case is not the use case that GAE is optimized for.
Fetch fewer records per call.
Example:'=

web2pyChildTableClass = db.ChildTable # gives the web2py Table class

theNativeGAEChildTableClass = web2pyChildTableClass._tableobj # magic... 
into native GAE handle <== This may have changed recently. Somehow get the 
native handle.

nativeChildTableQuery = theNativeGAEChildTableClass.all()

nativeChildTableQuery.filter('id =', 25)

nativeresults = nativeChildTableQuery.fetch(limit=10)  # Just get a few 
record at a time, using the 'limit' parameter.

myGAENativeChild = nativeresults[0]

On Monday, April 24, 2017 at 9:15:59 AM UTC-4, Karoly Kantor wrote:
>
> More info again, still hoping someone can help:
>
> I tried to replace the DAL query with native app engine code.
>
> Original DAL:
>
>             query=(
>                 (mydb[record].application == application_id) &
>                 (mydb[record].entity == entity_id) &
>                 (mydb[record].is_deleted == False))
>             
>             result = mydb(query).select()
>
> Native:
>
>  from google.appengine.ext import ndb
>             class record(ndb.Expando):
>                 pass
>             result = 
> record.query().filter(ndb.GenericProperty('application') == application_id, 
> ndb.GenericProperty('entity') == entity.id, 
> ndb.GenericProperty('is_deleted') == False)
>  
> I was hoping this will speed things up, but it did not. It was the same 
> slowness on the local dev env. On the server, the situation became even 
> worse:
>
> "While handling this request, the process that handled this request was 
> found to be using too much memory and was terminated. "
>
> Anyway, I still find it unreal that a query of 800 rows can last more than 
> 20 seconds. 
>
> Ideas are continue to be most welcome.
>   
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to