Eyal Gordon wrote: > Hello, > > I'm running sqlalchemy on python 2.4.3, with postgresql. My > application is multi-threaded, commits and queries are protected by a > python thread lock. I suspect that when running session.commit(), the > python global interpreter lock (GIL) remains owned by this thread > until the commit completes, such that other threads can not run until > the commit action completes (even thread that have nothing to do with > the database). > Is this correct?
at most it would only remain under the GIL while the psycopg2 connection is performing its own commit(), which is a tiny portion of the session.commit() procedure. If OTOH you are applying a mutex around Session.commit() yourself (which is what "commits and queries are protected by a python thread lock" sounds like), then its your own mutex that would be serializing the Session.commit() operation across threads. > > Thanks, > Eyal > > -- > 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. > > -- 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.
