From: | Alexander Kuzmenkov <a(dot)kuzmenkov(at)postgrespro(dot)ru> |
---|---|
To: | Daniel Gustafsson <daniel(at)yesql(dot)se>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
Cc: | 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-27 19:12:02 |
Message-ID: | 5ba5b6a1-7f52-da6a-6b52-11baee201451@postgrespro.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Daniel,
Thanks for the update.
On 07/25/2018 01:37 AM, Daniel Gustafsson wrote:
>
>> 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.
To trigger that, in your test example you could order by empno::int8 for
one window, and by empno::int2 for another. But don't I think you have
to compare eqop here, because if eqop differs, sortop will differ too. I
removed the comparison from the patch. I also clarified (I hope) the
comments, and did the optimization I mentioned earlier: using array
instead of list for active clauses. Please see the attached v6.
Otherwise I think the patch is good.
--
Alexander Kuzmenkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
Attachment | Content-Type | Size |
---|---|---|
0001-Order-windows-on-partition-ordering-prefix-to-reuse-v6.patch | text/x-patch | 11.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Dunstan | 2018-07-27 19:26:24 | Re: [HACKERS] WAL logging problem in 9.4.3? |
Previous Message | Robert Haas | 2018-07-27 18:16:39 | Re: My Skype account (korotkovae) was hacked |