thanks for the effort. Please use r4640 and specify rollback_returned=False to the Pool constructor.
On May 5, 2008, at 5:53 AM, Andrew Stromnov wrote: > > Ordered by: internal time > List reduced from 178 to 20 due to restriction <20> > > ncalls tottime percall cumtime percall filename:lineno(function) > # 215 0.371 0.002 0.371 0.002 {method 'query' of > '_mysql.connection' objects} > * 215 0.306 0.001 0.306 0.001 {method 'rollback' of > '_mysql.connection' objects} > 215 0.029 0.000 0.029 0.000 {method 'store_result' of > '_mysql.connection' objects} > 215 0.028 0.000 0.048 0.000 sqlalchemy/engine/base.py: > 1425(_init_metadata) > 215 0.022 0.000 0.022 0.000 {method 'next_result' of > '_mysql.connection' objects} > 232 0.020 0.000 0.246 0.001 utils.py:278(new_fun) > 232 0.017 0.000 1.305 0.006 RecentActions.py: > 197(GetCounter) > 215 0.013 0.000 0.498 0.002 MySQLdb/cursors.py: > 129(execute) > 215 0.012 0.000 0.050 0.000 MySQLdb/cursors.py: > 107(_do_get_result) > 211 0.011 0.000 0.037 0.000 decimal.py:516(__new__) > 215 0.009 0.000 0.036 0.000 sqlalchemy/engine/ > default.py:136(__init__) > 232 0.009 0.000 1.315 0.006 utils.py:178(protected) > 215 0.008 0.000 0.009 0.000 MySQLdb/cursors.py: > 40(__init__) > 430 0.008 0.000 0.014 0.000 threading.py:93(acquire) > 641 0.008 0.000 0.008 0.000 {built-in method match} > 211 0.006 0.000 0.014 0.000 decimal.py: > 3092(_string2exact) > * 215 0.006 0.000 0.346 0.002 sqlalchemy/pool.py: > 276(_finalize_fairy) > 215 0.006 0.000 0.613 0.003 sqlalchemy/engine/base.py: > 853(_execute_text) > 662 0.006 0.000 0.006 0.000 logging/__init__.py: > 1158(getEffectiveLevel) > > This is cumulative log for 215 requests. '#' - query to DB, '*' - > returning connection to the pool. > Times for query() and rollback() execution are comparable. > > Query is "SELECT person_id, type, sum(count) FROM CommentCounter WHERE > person = %d AND type = '%s' and answered in (0, 1) group by person_id" > > On May 4, 7:52 pm, Michael Bayer <[EMAIL PROTECTED]> wrote: >> On May 4, 2008, at 9:41 AM, Andrew Stromnov wrote: >> >> >> >>> Recently I'd switched to SA MySQL connection pool implementation. >>> Every time, when app returns connection to pool (through .close() >>> method), SA triggers .rollback() on this connection (http:// >>> www.sqlalchemy.org/trac/browser/sqlalchemy/trunk/lib/sqlalchemy/pool....) >>> . >>> In my case ROLLBACK is rather expensive operation and waste too much >>> MySQL time. I'm using MySQL 5.1 and "set autocommit=1" on >>> initialization. >> >>> How to disable this .rollback() triggering? >> >> its necessary so that any transactional state existing on the >> connection is discarded. "autocommit=1" is not part of DBAPI so >> SQLA >> is not built around that model....but even if it is switched on, it >> says nothing about table or row locks which may exist on the >> connection which also would need to be released via ROLLBACK. >> >> do you have any profiling data that illustrate ROLLBACK being >> expensive ? its generally an extremely cheap operation particularly >> if little or no state has been built up on the connection. > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---