1

次の選択クエリでExplainプランを実行していますが、Explainプランが返されません。説明プランは2〜3分前に戻ってきましたが、今では永遠にかかり、二度と戻りません。以下は私が実行しているexplainクエリです

explain SELECT * FROM
((
SELECT DISTINCT hi.target_profile_id, hi.handset_id
FROM handset_inclusions hi,
campaigns c,
campaigns_target_profiles ctp
WHERE hi.target_profile_id = ctp.target_profile_id
AND c.id=ctp.campaign_id
AND c.active=1
AND c.house_ad = true
ORDER BY target_profile_id, handset_id)
UNION DISTINCT
(
SELECT DISTINCT hi.target_profile_id, hi.handset_id
FROM handset_inclusions hi,
campaigns c,
campaign_flights f,
campaigns_target_profiles ctp
WHERE hi.target_profile_id = ctp.target_profile_id
AND c.id=ctp.campaign_id
AND c.active=1
AND c.house_ad = false
AND c.id = f.campaign_id
AND (f.active_flight = true or c.id in (199,857,947)
       OR (NOW() >= DATE_SUB(f.start_time, INTERVAL 6 HOUR)
           AND NOW() <= DATE_ADD(f.end_time, INTERVAL 6 HOUR)))
ORDER BY target_profile_id, handset_id)
UNION DISTINCT
(SELECT prof.target_profile_id, h.id as handset_id
FROM  (SELECT distinct (pc.target_profile_id) as target_profile_id
       FROM placements p, sites s, publishers pubs, placement_3PNchannel pc
       LEFT OUTER JOIN 3PNchannel c
       ON c.id = pc.3PNchannel_id
       WHERE p.id = pc.placement_id
         AND p.siteid = s.id
         AND pubs.id = s.publisherid
         AND pc.active = TRUE
         AND pubs.allows_3pn)prof, handsets h, handset_inclusions i
WHERE prof.target_profile_id = i.target_profile_id
  AND i.handset_id = h.id)) t
  order by t.target_profile_id;
4

1 に答える 1