----- Original Message ----
From: Jørgen Løland <Jorgen.Loland@stripped>
To: Karthik Gurukuntala <kgurukuntala@stripped>
Cc: Mark Leith <Mark.Leith@stripped>; internals@stripped
Sent: Thu, 25 February, 2010 6:18:17 PM
Subject: Re: Where is sum operation implemented?
Mark Leith wrote:
> Hi,
>
> On 25 Feb 2010, at 12:08, Karthik Gurukuntala wrote:
>
>>
>>
>> Dear All,
>>
>> I am new to MySQL codebase and its development. I am unable to find where the
SUM() aggregation operation of SELECT implemented. I mean, in which file in sql folder of
the codebase, can I see the implementation of SUM().
>>
>> The SUM() I mean, i.e., as in : SELECT SUM(salary) from salaries;
>
>
> Most of it is in sql/item_sum.cc (which also includes the other aggregate
functions).
If you look for the place where aggregates are updated with values from a row, see
Item_*::add() in the aforementioned file.
I did find the methods you mentioned, however, am unable to figure out the actual flow of
execution of such a select query I mentioned above. Like, from start(a query is fired) to
finish(results are displayed). Can you please help me in this regard?
-- Jørgen Løland
The INTERNET now has a personality. YOURS! See your Yahoo! Homepage.
http://in.yahoo.com/