0

我有很多表:

我得到了这个查询。执行需要 31.1896 秒。我觉得它很慢。下面看我的解释

SELECT 
    fe2a.*,
    fe2b.*,
    fe3a.*, 
    fe3b.*,
    fe4a.*,
    fe4b.*,  
    felap3b.*,
    rate.*,
    co21a.*, 
    co23a.*, 
    be1a.*,
    be1b.*, 
    be2a.*,
    be3b.*,
    be4a.*, 
    lab_h101.*,  
    lab_r201.*,
    lab_c301.*, 
    lab_co2produk.*,
    lab_r501_in.*,
    sg1b.*,k403lap1b.*, 
    k405l3b.*,
    kgb.*,
    prod_har.*,
    prod_8jam.* 

FROM 
    fe2a,
    fe2b,
    fe3a,
    fe3b,
    fe4a,
    fe4b, 
    felap3b, 
    rate, 
    co21a, 
    co23a,  
    be1a, 
    be1b, 
    be2a,
    be3b,
    be4a,
    lab_h101,
    lab_r201,
    lab_c301,
    lab_co2produk,
    lab_r501_in,
    sg1b, 
    k403lap1b,
    k405l3b,
    kgb,
    prod_har,
    prod_8jam 

WHERE 
    (fe2a.waktu_fe2a >= '2013-11-10 05:00:00' AND fe2a.waktu_fe2a < '2013-11-10 07:00:00') and 
    (fe2b.waktu_fe2b >= '2013-11-10 05:00:00' AND fe2b.waktu_fe2b < '2013-11-10 07:00:00') and 
    (fe3a.waktu_fe3a >= '2013-11-10 05:00:00' AND fe3a.waktu_fe3a < '2013-11-10 07:00:00') and 
    (fe3b.waktu_fe3b >= '2013-11-10 05:00:00' AND fe3b.waktu_fe3b < '2013-11-10 07:00:00') and  
    (fe4a.waktu_fe4a >= '2013-11-10 05:00:00' AND fe4a.waktu_fe4a < '2013-11-10 07:00:00') and 
    (fe4b.waktu_fe4b >= '2013-11-10 05:00:00' AND fe4b.waktu_fe4b < '2013-11-10 07:00:00')  and 
    (felap3b.waktu_felap3b >= '2013-11-10 05:00:00' AND felap3b.waktu_felap3b < '2013-11-10 07:00:00') and 
    (rate.waktu_rate >= '2013-11-10 00:00:00' AND rate.waktu_rate < '2013-11-10 23:59:59') and 
    (co21a.waktu_co21a >= '2013-11-10 05:00:00' AND co21a.waktu_co21a < '2013-11-10 07:00:00')  and 
    (co23a.waktu_co23a >= '2013-11-10 05:00:00' AND co23a.waktu_co23a < '2013-11-10 07:00:00') and 
    (be1a.waktu_be1a >= '2013-11-10 05:00:00' AND be1a.waktu_be1a < '2013-11-10 07:00:00') and 
    (be1b.waktu_be1b >= '2013-11-10 05:00:00' AND be1b.waktu_be1b < '2013-11-10 07:00:00') and 
    (be2a.waktu_be2a >= '2013-11-10 05:00:00' AND be2a.waktu_be2a < '2013-11-10 07:00:00') and 
    (be3b.waktu_be3b >= '2013-11-10 05:00:00' AND be3b.waktu_be3b < '2013-11-10 07:00:00') and 
    (be4a.waktu_be4a >= '2013-11-10 05:00:00' AND be4a.waktu_be4a < '2013-11-10 07:00:00')  and 
    (lab_h101.waktu_h101 >= '2013-11-10 00:00:00' AND lab_h101.waktu_h101 < '2013-11-10 23:59:59') and 
    (lab_r201.waktu_r201 >= '2013-11-10 00:00:00' AND lab_r201.waktu_r201 < '2013-11-10 23:59:59') and 
    (lab_c301.waktu_c301 >= '2013-11-10 00:00:00' AND lab_c301.waktu_c301 < '2013-11-10 23:59:59') and 
    (lab_co2produk.waktu_co2produk >= '2013-11-10 00:00:00' AND lab_co2produk.waktu_co2produk < '2013-11-10 23:59:59') and 
    (lab_r501_in.waktu_r501_in >= '2013-11-10 00:00:00' AND lab_r501_in.waktu_r501_in < '2013-11-10 23:59:59') and 
    (sg1b.waktu_sg1b >= '2013-11-10 05:00:00' AND sg1b.waktu_sg1b < '2013-11-10 07:00:00') and 
    (k403lap1b.waktu_k403lap1b >= '2013-11-10 05:00:00' AND k403lap1b.waktu_k403lap1b < '2013-11-10 07:00:00') and 
    (k405l3b.waktu_k405l3b >= '2013-11-10 05:00:00' AND k405l3b.waktu_k405l3b < '2013-11-10 07:00:00') and  
    (kgb.waktu_kgb >= '2013-11-10 00:00:00' AND kgb.waktu_kgb < '2013-11-10 23:59:59') and 
    (prod_har.waktu_prod_har >= '2013-11-10 00:00:00' AND prod_har.waktu_prod_har < '2013-11-10 23:59:59') and 
    (prod_8jam.waktu_prod_8jam >= '2013-11-10 05:00:00' AND prod_8jam.waktu_prod_8jam < '2013-11-10 07:00:00') LIMIT 1

有什么建议可以优化这个脚本,因为它非常耗时?

4

0 回答 0