Search code examples
mysqlsqloptimizationexplain

Judging Length of SQL Query based on Explain


I am trying to get a ball park estimate about how long a query is going to take based on the output of the explain. I am using a MYSQL database.

I know that you can't determine how a long a query is going to take with any certainty. I am just looking for a ballpark estimate, i.e. 1 hour, 8 hours, 1 day, 2 weeks etc. Thank you!

enter image description here


Solution

  • you can't, it totally depends of your infrastructure. The explain plan is first of all really indicative, and then really relative to your server.

    Use TKPROF for better results anyway.

    EDIT: Mysql doesn't have tkprof unlike Oracle (The rest is still valid) Instead, use PROFILING for mor relevant informations: http://dev.mysql.com/doc/refman/5.0/en/show-profiles.html