Re: Preformance in multiple join
Posted by: Felix Geerinckx
Date: January 17, 2007 05:11AM

Did you try something like
SELECT
    SUM(IF(P.price_type = 'novaout',       P.p_minute*duration/60)) AS novaoutmin,
    SUM(IF(P.price_type = 'clientout',     P.p_minute*duration/60)) AS clientoutmin,
    SUM(IF(P.price_type = 'novarouting',   P.p_minute*duration/60)) AS novaroutingmin,
    SUM(IF(P.price_type = 'clientrouting', P.p_minute*duration/60)) AS clientrouting,
	...
FROP t_telco_data D
LEFT JOIN t_price P 
    ON P.dial_string = D.dial_string AND 
       D.date BETWEEN P.start_date AND P.end_date AND
       FIND_IN_SET(D.billing_type,P.billing_type)>0
WHERE
    D.date BETWEEN '2006-12-01' AND '2006-12-31' 
GROUP BY ...
ORDER BY ...

Perhaps your queries will benefit from an index on a composite (start_date, end_date) index.

Could you also post the output of
EXPLAIN SELECT ...
for your queries?

(And please use BBCode tags for your queries and EXPLAIN output)

--
felix
Please use BBCode to format your messages in this forum.

Options: ReplyQuote


Subject
Written By
Posted
Re: Preformance in multiple join
January 17, 2007 05:11AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.