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

Leonardo B. Lopes leo at iems.nwu.edu
Thu Oct 4 12:14:56 EDT 2001


Thanks for the tip. I actually have used the explain statement. But are
you sure about the profiler ignoring the time taken by the query? Why
would it be excluded from the computation time? How would the profiler
even be able to distinguish between time waiting in a function for some
external process and time spent in the python interpreter itself? I
checked the manual for the profiler section. It says that the profiler is
activated by callbacks when functions are called and when they return, so
if a function is blocked waiting for mysql, that time should be computed. 

Thanks!
Leo.


On Wed, 3 Oct 2001, Skip Montanaro wrote:

> 
>     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/
> 

========================================================================
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