Hello Michael, 2010/8/18 Michael Hipp <[email protected]>: > <snip> > Is this a typical/expected difference in performance between the two query > methods? > <snip code>
Yes. This is expected. When you use the ORM, SQLAlchemy has to instantiate Python objects and populate each property from the result set (and maybe more objects from relations). That takes some time. That doesn't happen when using "SQL Expression Language" as what you get back is basically a bunch of tuples for every result set. It's lower level than the ORM (the ORM actually sits on top of the Expression Language system). And, quite recently, some part of the SQL Expression Language layer has gain a C extension (not enabled by default). So you may gain some little improvement using the ORM (~20%), but the using the Expression Languages system itself should be much faster. -- Alex twitter.com/alexconrad -- 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.
