Sort keys are omitted incorrectly after grouping sets
| От | Richard Guo |
|---|---|
| Тема | Sort keys are omitted incorrectly after grouping sets |
| Дата | |
| Msg-id | CAMbWs48AtQTQGk37MSyDk_EAgDO3Y0iA_LzvuvGQ2uO_Wh2muw@mail.gmail.com обсуждение исходный текст |
| Ответы |
Re: Sort keys are omitted incorrectly after grouping sets
|
| Список | pgsql-hackers |
Hi hackers,
This works correctly and efficiently in scan/join planning since the
members in an EC are always equal to each other.
However, after applying GROUP BY grouping sets, the members in an EC may
not be that equivalent any more, because NULLS may be emitted by
grouping sets. As a result, we may lose some sort keys incorrectly.
# explain (costs off) select a, b from foo where a = b group by cube(a, b) order by a, b;
QUERY PLAN
-------------------------------
Sort
Sort Key: a
-> MixedAggregate
Hash Key: a, b
Hash Key: a
Hash Key: b
Group Key: ()
-> Seq Scan on foo
Filter: (a = b)
(9 rows)
I believe we should not ignore sort key 'b' in the query above.
Is this a problem we should be worried about?
Thanks
Richard
В списке pgsql-hackers по дате отправления: