title: mysql query is taking too much time to execute
body: <p>Hello everyone I am working on phpmyadmin database. Whenever I try to execute query it takes too much time more than 10 mins to show results. Is there any way to speed it up. please response.</p>
  
  <p>The query is </p>
  
  <pre><code>SELECT ib.*, b.brand_name, m.model_name,
         s.id as sale_id, br.branch_code,br.branch_name,r.rentry_date,r.id as rid
    from in_book ib 
    left join brand b on ib.brand_id=b.id
    left join model m on ib.vehicle_id=m.id
    left join re_entry r on r.in_book_id=ib.id
    left join sale s on ib.id=s.in_book_id
    left join branch br on ib.branch_id=br.id
   where ib.id !=''
     and ib.branch_id='65'
   group by ib.id
   order by r.id ASC,
         count(r.in_book_id) DESC ,
         ib.purchaes_date ASC,
         ib.id ASC
  </code></pre>
  
  <p>there are almost 7 tables</p>