public inbox for [email protected]
help / color / mirror / Atom feedFrom: Andy Fan <[email protected]>
To: David Rowley <[email protected]>
Cc: Zhihong Yu <[email protected]>
Cc: PostgreSQL Developers <[email protected]>
Subject: Re: Window Function "Run Conditions"
Date: Wed, 18 Aug 2021 20:20:45 +0800
Message-ID: <CAKU4AWq5MB_inrYUwPQYXU1fCopCwgYK53N2uYGYFBH3QEhZMA@mail.gmail.com> (raw)
In-Reply-To: <CAApHDvpiAUmUMTETAua8XCLFJiFhsZkCwuiW50KDvehexA-SLA@mail.gmail.com>
References: <CAApHDvqvp3At8++yF8ij06sdcoo1S_b2YoaT9D4Nf+MObzsrLQ@mail.gmail.com>
<CAApHDvrxxkc9dgoRJUHy6U+XmGjSXRF=fQ-_U1-EvzTjCA9XKw@mail.gmail.com>
<CALNJ-vSRgdOsMx-oiOZcMJzcxoRCo0nJr=U8us4eJR8R6n9ZtA@mail.gmail.com>
<CAApHDvpiAUmUMTETAua8XCLFJiFhsZkCwuiW50KDvehexA-SLA@mail.gmail.com>
Hi David:
Thanks for the patch.
On Wed, Aug 18, 2021 at 6:40 PM David Rowley <[email protected]> wrote:
>
> On Tue, 17 Aug 2021 at 03:51, Zhihong Yu <[email protected]> wrote:
> > + if ((res->monotonic & MONOTONICFUNC_INCREASING) == MONOTONICFUNC_INCREASING)
> >
> > The above can be simplified as 'if (res->monotonic & MONOTONICFUNC_INCREASING) '
>
> True. I've attached an updated patch.
>
> David
Looks like we need to narrow down the situation where we can apply
this optimization.
SELECT * FROM
(SELECT empno,
salary,
count(*) over (order by empno desc) as c ,
dense_rank() OVER (ORDER BY salary DESC) dr
FROM empsalary) emp
WHERE dr = 1;
In the current master, the result is:
empno | salary | c | dr
-------+--------+---+----
8 | 6000 | 4 | 1
(1 row)
In the patched version, the result is:
empno | salary | c | dr
-------+--------+---+----
8 | 6000 | 1 | 1
(1 row)
--
Best Regards
Andy Fan (https://www.aliyun.com/)
view thread (14+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: Window Function "Run Conditions"
In-Reply-To: <CAKU4AWq5MB_inrYUwPQYXU1fCopCwgYK53N2uYGYFBH3QEhZMA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox