| От | Craig Harris |
|---|---|
| Тема | extra TARGETENTRY when group by function( col )? |
| Дата | |
| Msg-id | 20101222161336.8B85B1337990@mail.postgresql.org обсуждение |
| Ответы |
Re: extra TARGETENTRY when group by function( col )?
|
| Список | 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.
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера