SQL/Python question -- slow... What is the fixed cost?

Leonardo B Lopes leo at iems.nwu.edu
Wed Oct 3 17:07:09 EDT 2001


Dear Friends,

	Is anyone here using Python with MySQL using the MySQLdb module? I have
been using it for a while in a prototype, and now that I am trying to
optimize it for speed I am running into problems.

	I was analyzing my queries, trying to find out if a different
organization of my database might be warranted. I do lots and lots of
queries, most of which are quite simple. The worst query involves an
inner join of 3 tables and then a filtering on two clauses.

	I have been using varchar columns as indexes (I know! It was just a
prototype), and as I am considering changing them, I am looking at the
output of the python profiler, and I notice that all the queries take
.001 cpu/sec. per call. Not only the more complex query above, but also
a query which only filters over one small table.

	What I am wondering is what the fixed cost for this configuration:
(python + MySQLdb + MySQL). I am about to design a sophisticated caching
system, and before I do that, I was hoping someone with some experience
with this setup would be able to tell me if it is worth my time... Any
help would be appreciated. I can also share code if it helps.

Thanks!
Leo.
a simple query that filters only one table based on only one parameter.

	That brings a question: Does anyone have an idea of what 
-- 
=======================================================================
Leonardo B. Lopes                                      leo at iems.nwu.edu 
Ph.D. Student                                             (847)491-8470
IEMS - Northwestern University             http://www.iems.nwu.edu/~leo



More information about the Python-list mailing list