Re: Function array_agg(array)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Function array_agg(array)
Дата
Msg-id 24866.1416957747@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Function array_agg(array)  (Ali Akbar <the.apaan@gmail.com>)
Список pgsql-hackers
Ali Akbar <the.apaan@gmail.com> writes:
> Just curious, in accumArrayResultArr, while enlarging array and
> nullbitmaps, why it's implemented with:

> astate->abytes = Max(astate->abytes * 2,
> astate->nbytes + ndatabytes);
> and
> astate->aitems = Max(astate->aitems * 2, newnitems);

> won't it be more consistent if it's implemented just like in the first
> allocation?:

> while (astate->aitems <= newnitems)
> astate->aitems *= 2;

The idea was to try to force the initial allocation to be a power of 2,
while not insisting on that for later enlargements.  I can't point to any
hard reasons for doing it that way, but it seemed like a good idea.
Power-of-2 allocations are good up to a certain point but after that they
tend to get wasteful ...
        regards, tom lane



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

Предыдущее
От: Ali Akbar
Дата:
Сообщение: Re: Function array_agg(array)
Следующее
От: Ali Akbar
Дата:
Сообщение: Re: [REVIEW] Re: Fix xpath() to return namespace definitions