Re: pg_trgm Memory Allocation logic

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: pg_trgm Memory Allocation logic
Дата
Msg-id 20150309125456.GK3291@alvh.no-ip.org
обсуждение исходный текст
Ответ на pg_trgm Memory Allocation logic  (Beena Emerson <memissemerson@gmail.com>)
Ответы Re: pg_trgm Memory Allocation logic  (Heikki Linnakangas <hlinnaka@iki.fi>)
Список pgsql-hackers
Beena Emerson wrote:
> In the pg_trgm module, within function generate_trgm, the memory for trigrams
> is allocated as follows:
> 
> trg = (TRGM *) palloc(TRGMHDRSIZE + sizeof(trgm) * (slen / 2 + 1) *3);
> 
> I have been trying to understand why this is so because it seems to be
> allocating more space than that is required.

Maybe it's considering a worst-case for multibyte characteres?  I don't
really know if trgm supports multibyte, but I assume it does.  If it
does, then probably the trigrams consist of chars, not bytes.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



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

Предыдущее
От: Andreas Karlsson
Дата:
Сообщение: Re: Using 128-bit integers for sum, avg and statistics aggregates
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Object files generated by ecpg test suite not ignored on Windows