Re: [PERFORM] Additional select fields in a GROUP BY

2004-06-13 Thread Tom Lane
Vitaly Belman <[EMAIL PROTECTED]> writes: > Notice that the GROUP BY items added the following to the plan: > -> Sort (cost=10454.67..10600.83 rows=58466 width=47) > Sort Key: s.series_id, s.series_name, s.series_picture Oh, I see: in the first case you need no

Re: [PERFORM] Additional select fields in a GROUP BY

2004-06-13 Thread Vitaly Belman
Bruno: It wasn't exactly my case but you did give me an idea by this tip, changing a perspective did quite good to the timing of this query. Tom: Hmm.. I am not sure how I can demonstrate this to you... To see the time differences you'd need the whole table.. That's quite a lot of data to be pos

Re: [PERFORM] Additional select fields in a GROUP BY

2004-06-13 Thread Bruno Wolff III
On Sun, Jun 13, 2004 at 06:21:17 +0300, Vitaly Belman <[EMAIL PROTECTED]> wrote: > > Consider the following query: > > select t1field1, avg(t2fieild2) > from t1, t2 > where t1.field1 = t2.field2 > group by t1field1 > > That works fine. But I'd really like to see more fields of t1 in this > que

Re: [PERFORM] Additional select fields in a GROUP BY

2004-06-12 Thread Tom Lane
Vitaly Belman <[EMAIL PROTECTED]> writes: > The problem is that addind them all to GROUP BY causes a performance > loss. Really? I'd think that there'd be no visible loss if the earlier fields of the GROUP BY are already unique. The sort comparison should stop at the first field that determines

[PERFORM] Additional select fields in a GROUP BY

2004-06-12 Thread Vitaly Belman
Hello, Consider the following query: select t1field1, avg(t2fieild2) from t1, t2 where t1.field1 = t2.field2 group by t1field1 That works fine. But I'd really like to see more fields of t1 in this query, however I can't add them into the select because they're not part of the GROUP BY, thus I ha