Database query execution times in Python?

P

pwnedd

Hi all,

I've been writing some code using libraries based on the Python Database API
2.0 (MySQLdb & pg), and so far things are working really well. There is one
thing that I have not been able to figure out how to do, however:

Retrieve the time is took a given query to execute.

Does anyone know if this is possible?

Any help would be greatly appreciated.

Thanks!
Keith
 
A

Aahz

I've been writing some code using libraries based on the Python Database API
2.0 (MySQLdb & pg), and so far things are working really well. There is one
thing that I have not been able to figure out how to do, however:

Retrieve the time is took a given query to execute.

Look up EXPLAIN
--
Aahz ([email protected]) <*> http://www.pythoncraft.com/

"...string iteration isn't about treating strings as sequences of strings,
it's about treating strings as sequences of characters. The fact that
characters are also strings is the reason we have problems, but characters
are strings for other good reasons." --Aahz
 
A

Aahz

Thanks for the suggestion. I don't see any option to have EXPLAIN display
the query time though?

My suggestion was partly a gentle push toward a database forum to get
more information -- this isn't really a Python question. Unless all you
want to do is get the wall-clock time, in which case just use
time.time().
--
Aahz ([email protected]) <*> http://www.pythoncraft.com/

"Given that C++ has pointers and typecasts, it's really hard to have a
serious conversation about type safety with a C++ programmer and keep a
straight face. It's kind of like having a guy who juggles chainsaws
wearing body armor arguing with a guy who juggles rubber chickens wearing
a T-shirt about who's in more danger." --Roy Smith
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top