Re: Allow WindowFuncs prosupport function to use more optimal WindowClause options

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: Allow WindowFuncs prosupport function to use more optimal WindowClause options
Дата
Msg-id CAApHDvrkLLWt6SYQChPy+PJj_9UxV+KRWas1yzaKH9aTF0V=Uw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Allow WindowFuncs prosupport function to use more optimal WindowClause options  (David Rowley <dgrowleyml@gmail.com>)
Ответы Re: Allow WindowFuncs prosupport function to use more optimal WindowClause options  (Vik Fearing <vik@postgresfriends.org>)
Список pgsql-hackers
On Wed, 26 Oct 2022 at 14:38, David Rowley <dgrowleyml@gmail.com> wrote:
>
> On Sun, 23 Oct 2022 at 03:03, Vik Fearing <vik@postgresfriends.org> wrote:
> > Shouldn't it be able to detect that these two windows are the same and
> > only do one WindowAgg pass?
> >
> >
> > explain (verbose, costs off)
> > select row_number() over w1,
> >         lag(amname) over w2
> > from pg_am
> > window w1 as (order by amname),
> >         w2 as (w1 rows unbounded preceding)
> > ;
>
> Good thinking. I think the patch should also optimise that case. It
> requires re-doing a similar de-duplication phase the same as what's
> done in transformWindowFuncCall().  I've added code to do that in the
> attached version.

I've spent a bit more time on this now and added a few extra
regression tests.  The previous version had nothing to test to ensure
that an aggregate function being used as a window function does not
have its frame options changed when it's sharing the same WindowClause
as a WindowFunc which can have the frame options changed.

I've now pushed the final result.  Thank you to everyone who provided
input on this.

David



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

Предыдущее
От: Ranier Vilela
Дата:
Сообщение: Re: ARRNELEMS Out-of-bounds possible errors
Следующее
От: "Imseih (AWS), Sami"
Дата:
Сообщение: Re: Call lazy_check_wraparound_failsafe earlier for parallel vacuum