Re: Avoid extra Sort nodes between WindowAggs when sorting can be reused

From: Daniel Gustafsson <daniel(at)yesql(dot)se>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: Alexander Kuzmenkov <a(dot)kuzmenkov(at)postgrespro(dot)ru>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Avoid extra Sort nodes between WindowAggs when sorting can be reused
Date: 2018-07-24 22:37:06
Message-ID: 0291AC74-9B0C-43E9-B353-5FC07D8EA267@yesql.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On 3 Jul 2018, at 12:24, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:

> Thank you for updating the patch.

Thanks for reviewing!

> Hmm, this is missing the eqop fields of SortGroupClause. I haven't
> tested yet but does the similar degradation happen if two
> SortGroupCaluses have different eqop and the same other values?

I wasn’t able to construct a case showing this, but I also think you’re right.
Do you have an idea of a query that can trigger a regression? The attached
patch adds a stab at this, but I’m not sure if it’s the right approach.

> The source code comments for common_prefix_cmp() function and
> WindowClauseSortNode struct is needed.

Fixed.

> + from empsalary;
>
> I think it's better to change "from empsalary" to "FROM empsalary" for
> consistency with other code.

Yes, that was a silly oversight. Fixed.

cheers ./daniel

Attachment Content-Type Size
window_prefix_sort-v5.patch application/octet-stream 10.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Toshi Harada 2018-07-24 22:51:48 "WIP: Data at rest encryption" patch and, 2 phase commit.
Previous Message Isaac Morland 2018-07-24 22:29:37 Re: How can we submit code patches that implement our (pending) patents?