Re: tsearch profiling - czech environment - take 55MB

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: tsearch profiling - czech environment - take 55MB
Дата
Msg-id 162867791003110908y18e4f0b3v4f2c62d62420f163@mail.gmail.com
обсуждение исходный текст
Ответ на Re: tsearch profiling - czech environment - take 55MB  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: tsearch profiling - czech environment - take 55MB  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
2010/3/11 Pavel Stehule <pavel.stehule@gmail.com>:
> 2010/3/11 Tom Lane <tgl@sss.pgh.pa.us>:
>> Pavel Stehule <pavel.stehule@gmail.com> writes:
>>> There are some wrong in our implementation NISortDictionary. After
>>> initialisation is ts_cache memory context 55MB long and pg takes
>>> 190MB.
>>
>> What's your tsearch configuration exactly?
>>

I have a 64bit Linux.

The problem is in very large small allocations - there are 853215 nodes.

The memory can be minimalized with some block allocations

static void.
binit(void)
{
<------>data = NULL;
<------>allocated = 0;
}


static char *
balloc(size_t size)
{
<------>char *result;
<------>
<------>if (data == NULL || size > allocated )
<------>{
<------><------>data = palloc(1024 * 100);
<------><------>allocated = 1024 * 100;
<------>}
<------>
<------>result = data;
<------>data += size;
<------>allocated -= size;
<------>memset(result, 0, size);
<------>
<------>return result;
}

I replaced palloc0 inside mkSPnode by balloc

cspell: 25626352 total in 349 blocks; 11048 free (2 chunks); 25615304 used Ispell dictionary init context: 27615288
totalin 13 blocks; 7710864
 
free (34 chunks); 19904424 used

versus

cspell: 55853736 total in 6789 blocks; 130208 free (1553 chunks); 55723528 used Ispell dictionary init context:
27615288total in 13 blocks; 7710864
 
free (34 chunks); 19904424 used

Regards
Pavel


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

Предыдущее
От: Zdenek Kotala
Дата:
Сообщение: Re: gothic_moth, codlin_moth failures on REL8_2_STABLE
Следующее
От: Tom Lane
Дата:
Сообщение: Re: tsearch profiling - czech environment - take 55MB