[sqlalchemy] slow get query - somes taking 1.5 sec

2011-06-26 Thread nospam
I'm seeing a simple get taking a considerable amount of time. a = session.query(Annotation).get(annotation.id) This line can take anywhere between 0.15 secs to all the way up to 1.5 secs ... The query sqlalchemy produces is below. If I execute the query in pgadmin, it consistently runs in 47

Re: [sqlalchemy] slow get query - somes taking 1.5 sec

2011-06-26 Thread Michael Bayer
You have a tremendous amount of LEFT OUTER JOINS in there, and its hard to tell but it seems like you're doing lots of with_polymorphic queries as well as lazy='joined' styles of relationships, making for a very cumbersome query. That it returns the first result quickly (that's your 47 msec)