Re: Removing useless DISTINCT clauses

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: Removing useless DISTINCT clauses
Дата
Msg-id CAKJS1f_bVuvELikOsKRJ-uEPGUBxK7pyLp9H0eOTPNWsL-Sxng@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Removing useless DISTINCT clauses  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Removing useless DISTINCT clauses  (Jim Finnerty <jfinnert@amazon.com>)
Список pgsql-hackers
On 8 April 2018 at 08:55, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> regression=# create table t1 (a int,b int, c int, d int, primary key(a,b));
> CREATE TABLE
> regression=# explain verbose select distinct * from t1 order by a,c,b;
> server closed the connection unexpectedly
>         This probably means the server terminated abnormally
>         before or while processing the request.

Ouch!

> The reason is we're hitting this assert, a bit further down in
> create_distinct_paths:
>
>             /* Assert checks that parser didn't mess up... */
>             Assert(pathkeys_contained_in(root->distinct_pathkeys,
>                                          needed_pathkeys));
>
>
> I don't think that that makes this patch unsalvageable.  The way forward
> probably involves remembering that we removed some distinctClause items
> (so that we know the correspondence to the sortClause no longer holds)
> and then working harder in create_distinct_paths when that's the case.
>
> However, that's not something that's going to happen on the last day
> of the commitfest.  So I'm going to mark this Returned With Feedback
> and encourage you to return to the matter in v12.
>
> In the meantime, attached is the version of the patch that I was about to
> commit before getting cold feet.  It has some cosmetic improvements
> over yours, notably comment additions in allpaths.c.

Thanks a lot for spending time on this.

I'll no doubt have some time over this coming winter to see if it can
be fixed and re-submitted in the PG12 cycle.


-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: [HACKERS] Runtime Partition Pruning
Следующее
От: David Rowley
Дата:
Сообщение: Re: [HACKERS] Runtime Partition Pruning