| From: | Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com> |
|---|---|
| To: | David Rowley <dgrowleyml(at)gmail(dot)com> |
| Cc: | Zhihong Yu <zyu(at)yugabyte(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Window Function "Run Conditions" |
| Date: | 2021-08-18 12:20:45 |
| Message-ID: | CAKU4AWq5MB_inrYUwPQYXU1fCopCwgYK53N2uYGYFBH3QEhZMA@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi David:
Thanks for the patch.
On Wed, Aug 18, 2021 at 6:40 PM David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
>
> On Tue, 17 Aug 2021 at 03:51, Zhihong Yu <zyu(at)yugabyte(dot)com> 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/)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Hannu Krosing | 2021-08-18 12:21:26 | pgbench functions as extension |
| Previous Message | Julien Rouhaud | 2021-08-18 12:20:08 | Re: NAMEDATALEN increase because of non-latin languages |