Hi David:
Thanks for the patch.
On Wed, Aug 18, 2021 at 6:40 PM David Rowley <dgrowleyml@gmail.com> wrote:
>
> On Tue, 17 Aug 2021 at 03:51, Zhihong Yu <zyu@yugabyte.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/)