Re: [Sqlalchemy-tickets] [sqlalchemy] #2174: .7 performance regression for count queries with MyISA
Brought to you by:
zzzeek
From: sqlalchemy <mi...@zz...> - 2011-05-23 14:30:17
|
#2174: .7 performance regression for count queries with MyISAM ---------------------------------+------------------------------------------ Reporter: guest | Owner: zzzeek Type: defect | Status: closed Priority: medium | Milestone: 0.7.1 Component: orm | Severity: no triage selected yet Resolution: worksforme | Keywords: Status_field: completed/closed | ---------------------------------+------------------------------------------ Changes (by zzzeek): * status: new => closed * resolution: => worksforme * status_field: awaiting triage => completed/closed Comment: yup, the decision wasn't entirely easy but the new way works in all cases consistently, simply - the old way did not, as new kinds of bugs kept occurring, more exceptions and left turns kept getting made in count(), all just to avoid using a simple SQL expression that meets the use case exactly. So if you want to optimize a simple count for MyISAM, use func.count(): {{{ #!python session.query(func.count(Item.id)).scalar() }}} If MyISAM is really that stupid about a simple subquery then we should probably add a note to the MySQL docs regarding this. -- Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2174#comment:1> sqlalchemy <http://www.sqlalchemy.org/> The Database Toolkit for Python |