多个INNER JOINS非常慢 - 有更好的方法吗?

时间:2015-08-18 08:20:05

标签: mysql database query-optimization

我正在努力解决下面的问题。 它真的很慢,我无法弄清楚如何使它更有效?

    SELECT * FROM cBookings 
                INNER JOIN cBookings_details ON cBookings.cBookings_id=cBookings_details_cBookings_id 
                INNER JOIN cCustomers ON cBookings.cBookings_cCustomers_id=cCustomers.cCustomers_id 
                INNER JOIN cObjects ON cBookings_details.cBookings_details_cObjects_id = cObjects.cObjects_id
                WHERE cBookings_details.cBookings_details_cObjects_id = '".$oid."' 
                AND cBookings_details.cBookings_details_arrival <= '".$firstday."' 
                AND cBookings_details.cBookings_details_departure >= '".$firstday."' 
                GROUP BY(cBookings_details.cBookings_details_cObjects_id)

解释信息:enter image description here

0 个答案:

没有答案