Re: Window Function "Run Conditions"
От | Andy Fan |
---|---|
Тема | Re: Window Function "Run Conditions" |
Дата | |
Msg-id | CAKU4AWq5MB_inrYUwPQYXU1fCopCwgYK53N2uYGYFBH3QEhZMA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Window Function "Run Conditions" (David Rowley <dgrowleyml@gmail.com>) |
Ответы |
Re: Window Function "Run Conditions"
|
Список | pgsql-hackers |
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/)
В списке pgsql-hackers по дате отправления: