#830: dbquery: run_sql() should optionally return list-of-dictionaries
--------------------------+----------------------
Reporter: simko | Owner: rajimene
Type: enhancement | Status: closed
Priority: major | Milestone:
Component: MiscUtil | Version:
Resolution: fixed | Keywords:
--------------------------+----------------------
Comment (by bthiell):
MySQLdb has another type of cursor named DictCursor that returns
dictionaries, thus removing the additional step of building the
dictionary. It might be worth looking into it as it shows a significant
speed difference.
{{{
In [10]: %time res = test_with_dictcursor("SELECT * FROM bibrec_bib03x
LIMIT 1000000")
CPU times: user 4.53 s, sys: 0.02 s, total: 4.56 s
Wall time: 5.00 s
In [11]: %time res = invenio.dbquery.run_sql("SELECT * FROM bibrec_bib03x
LIMIT 1000000", with_dict=True)
CPU times: user 10.34 s, sys: 0.14 s, total: 10.48 s
Wall time: 10.90 s
}}}
See [http://www.halfcooked.com/mt/archives/000969.html this blog post] for
an example.
--
Ticket URL: <http://invenio-software.org/ticket/830#comment:5>
Invenio <http://invenio-software.org>