Hi There,
I've got a situation where I need to pull profit information by product
category, as well as the totals for each branch.
Basically, something like
SELECT branch_id, prod_cat_id, sum(prod_profit) as prod_cat_profit
FROM () as b1
WHERE x = y
GROUP BY branch, prod_cat_id
Now, I al
James Neethling wrote:
Hi There,
I've got a situation where I need to pull profit information by
product category, as well as the totals for each branch.
Basically, something like
SELECT branch_id, prod_cat_id, sum(prod_profit) as prod_cat_profit
FROM () as b1
WHERE x = y
GROUP BY branc
"Merlin Moncure" <[EMAIL PROTECTED]> writes:
> On 5/25/06, Tom Lane <[EMAIL PROTECTED]> wrote:
>> "Merlin Moncure" <[EMAIL PROTECTED]> writes:
>>> recent versions of mysql do much better, returning same set in < 20ms.
>> Are you sure you measured that right? I tried to duplicate this using
>> mys
On fös, 2006-05-26 at 11:56 +0200, James Neethling wrote:
> SELECT branch_id, prod_cat_id, sum(prod_profit) as prod_cat_profit
> FROM () as b1
> WHERE x = y
> GROUP BY branch, prod_cat_id
>
>
> Now, I also need the branch total, effectively,
> SELECT branch_id, sum(prod_profit) as branch_tot
On 5/26/06, Tom Lane <[EMAIL PROTECTED]> wrote:
Well, this bears looking into, because I couldn't get anywhere near 20ms
with mysql. I was using a dual Xeon 2.8GHz machine which ought to be
did you have a key on a,b,c? if I include unimportant unkeyed field d
the query time drops from 70ms to
"Merlin Moncure" <[EMAIL PROTECTED]> writes:
> did you have a key on a,b,c?
Yeah, I did
create index t1i on t1 (a,b,c);
Do I need to use some other syntax to get it to work?
> select count(*) from (select a,b,max(c) group by a,b) q;
> blows the high performance case as does putting the qu
On 5/26/06, Tom Lane <[EMAIL PROTECTED]> wrote:
"Merlin Moncure" <[EMAIL PROTECTED]> writes:
> did you have a key on a,b,c?
Yeah, I did
create index t1i on t1 (a,b,c);
Do I need to use some other syntax to get it to work?
can't thing of anything, I'm running completely stock, did you do
"Merlin Moncure" <[EMAIL PROTECTED]> writes:
> can't thing of anything, I'm running completely stock, did you do a
> optimize table foo?
Nope, never heard of that before. But I did it, and it doesn't seem to
have changed my results at all.
> mysql> select user_id, acc_id, max(sample_date) from u
On 5/26/06, Tom Lane <[EMAIL PROTECTED]> wrote:
> mysql> select user_id, acc_id, max(sample_date) from usage_samples group by
1,2
> 939 rows in set (0.07 sec)
0.07 seconds is not impossibly out of line with my result of 0.15 sec,
maybe your machine is just 2X faster than mine. This is a 2.8GHz
"Merlin Moncure" <[EMAIL PROTECTED]> writes:
> your time of 150 ms is looking like the slow case on my results.
Yeah... so what's wrong with my test? Anyone else care to duplicate
the test and see what they get?
regards, tom lane
---(end of broadc
10 matches
Mail list logo