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

Skip Montanaro skip at pobox.com
Thu Oct 4 03:31:34 CEST 2001


    Leonardo> I am looking at the output of the python profiler, and I
    Leonardo> notice that all the queries take .001 cpu/sec. per call. Not
    Leonardo> only the more complex query above, but also a query which only
    Leonardo> filters over one small table.

You're not measuring what you think you're measuring.  The .001 cpu seconds
per call is in the Python process.  It says nothing about how long it takes
the MySQL database to process the query.  If you're worried about
performance you should be profiling the queries in the database server, not
the Python client.

Check out the MySQL docs and in particular the EXPLAIN statement.

-- 
Skip Montanaro (skip at pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/




More information about the Python-list mailing list