Re: Count of records in a row

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: Count of records in a row
Дата
Msg-id CAHyXU0yMqC0_GpkTdqrvuRqebHaoZkCdYPG4weC2BXcEsi4_FA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Count of records in a row  (Rémi Cura <remi.cura@gmail.com>)
Ответы Re: Count of records in a row  (Rémi Cura <remi.cura@gmail.com>)
Список pgsql-general
On Tue, Oct 22, 2013 at 9:43 AM, Rémi Cura <remi.cura@gmail.com> wrote:
> Thanks again for the precision !
>
> I still don't understand perfectly. We call the aggregate n times, and each
> time we compute the aggregate, using (potentially) n rows, thus becoming (at
> most) O(n*n).
>
> With a standard loop, I loop n times, and each times I only need the current
> row plus the previous row which I put in memory, thus O(n).

For posterity, the above is incorrect.  Since the aggregate is ordered
through the window function, it gets executed exactly once per output
row.  It behaves exactly like a loop.  You know this because there is
no array in the aggregate state.

merlin


В списке pgsql-general по дате отправления:

Предыдущее
От: Shaun Thomas
Дата:
Сообщение: Re: Backup Question
Следующее
От: Rémi Cura
Дата:
Сообщение: Re: Count of records in a row