Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

It is said that the number of rows are scanned is smaller the performance is higher when use Explain to optimize query. So I wonder

  • When the EXPLAIN output includes many rows, is there any formula to calculate the total number of rows which is scanned? After searching on internet, it seems the total number of rows is the product of values of all rows in EXPLAIN output. But does it makes sense in case we use UNION?
  • Are there another criteria we should combine with 'rows' column in EXPLAIN output to know performance of query? Because if the formula is multiplying all number of rows, there are some cases the time execute the query is faster but the total number of rows is scanned is larger.
share|improve this question
    
I always spot check the number of rows to see that it makes sense. EXPLAIN is just the query optimizer's goal for the task. There are many other factors that go into performance (column types, truly proper indexing, disk IO, etc.). –  Alain Collins Nov 4 '12 at 6:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.