MySQL Forums
Forum List  »  Optimizer & Parser

Re: aggregation in mysql
Posted by: luca ghionna
Date: February 28, 2010 02:21PM

Hi, thank you for your reply.

an example might be the following (just to give a rough idea):

given a relation order(id_ord, amount) and transaction (trans_id, ord_id) you want:

select id_ord,sum(amount) from order,transaction where id_ord=ord_id group-by id_ord

you can easily perform a group on ord_id and count for each of them the number of transactions involved and then join the result with order to have the correct sum (you can write this by a simple rewritten sql query).

Is there any technical report available to test optimization policy of mysql?

Options: ReplyQuote

Written By
February 27, 2010 11:05AM
February 28, 2010 01:48PM
Re: aggregation in mysql
February 28, 2010 02:21PM

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.