私の両方のクエリは別々に高速に動作しますが、両方のクエリを結合すると実行に時間がかかります。
SELECT b.*,
a.*
FROM (SELECT r.vou_no,
r.vou_date,
r.lr_date,
r.due_date,
r.vac_code,
r.vamount,
r.vmfg_amt,
r.vter_cd,
r.mkt_year,
r.mnth_code
FROM ledfile AS r
WHERE r.mkt_year = 2012
AND r.mnth_code BETWEEN 201210 AND 201306
AND r.div_code = 1
AND r.vdepo_code = 21
AND r.vbook_cd = 80
AND Ifnull(r.del_tag, '') <> 'D'
ORDER BY r.vac_code,
r.vou_date,
r.vou_no) b,
(SELECT a.vac_code vcode,
a.vouno,
a.bill_date,
a.vamount vamt,
a.vou_date vdate
FROM rcpfile a
WHERE a.mkt_year = 2012
AND a.div_code = 1
AND a.vdepo_code = 21
AND a.vbook_cd IN ( 20, 21, 22, 90,
98, 80 )
AND Ifnull(a.del_tag, '') <> 'D'
ORDER BY a.vac_code,
a.bill_date,
a.vouno) a
WHERE a.vcode = b.vac_code
AND a.vouno = b.vou_no
AND a.bill_date = b.vou_date;