On Oct 16, 2008, at 1:23 PM, g00fy wrote:

>
> I do have correct results, but this is very slow.
> I assume that I have to query(Model) whitout any relations
> and then eagerload or join or whatever that will make this work for
> me.
>
> Am i right that mapper's lazy=False is not good for this situation ?

lazy=False specifically means, "join to related tables automatically,  
to enable population of related elements and collections" - it means  
you'd like eager loading to take place in all cases.   So if you have  
slowness which is due to many secondary SELECT statements being issued  
each time a related attribute is first accessed, its very useful.  I  
would just suggest that using the eager load feature on a per-Query  
basis, i.e. via query.options(eagerload(...)), would give you finer  
grained control over when this feature is used.

if OTOH the slowness is due to an enormous collection of elements  
which load every time when eager loading is used, and you'd rather not  
load this collection in, then you would *not* want to use eager  
loading.  If you do need access to elements of a very large  
collection, there are other options which can help with this.

what is common here is that you need to understand the source of your  
application's slowness in order to determine the best action to take.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" 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/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to