From: | "Craig Harris" <harris(at)SummerEyes(dot)com> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | extra TARGETENTRY when group by function( col )? |
Date: | 2010-12-22 16:04:14 |
Message-ID: | 20101222161336.8B85B1337990@mail.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Given:
create table t1 ( c1 timestamp without time zone, c2 int );
explain verbose select to_char ( c1, '<whatever>' ) from t1
group by to_char ( c1, '<whatever>' );
does any one know why the SEQSCAN node has TWO TARGETENTRYs?
Why do we project "c1" as well as "to_char( c1 . )" ?
---
For cases where we compute an aggregate, such as:
select min(c1), to_char(c1,.) from t1 group by to_char( c1,.)
it would make (some kind of) sense to project out "c1".
But can't the planner/optimizer distinguish these cases on the basis that
'min' is an aggregate function and 'to_char' is not?
The planner seems to be computing a minimal target list of columns (no
expressions) first. Guess I'm asking why it isn't replaced.
From | Date | Subject | |
---|---|---|---|
Next Message | Reto Schöning | 2010-12-22 16:08:54 | Re: "could not accept SSPI security context" |
Previous Message | Sim Zacks | 2010-12-22 15:59:57 | could not open relation...No such file or directory |