Re: Patch for fixing a few memory leaks

Поиск
Список
Период
Сортировка
От Teodor Sigaev
Тема Re: Patch for fixing a few memory leaks
Дата
Msg-id 3BBD76CE.9080308@stack.net
обсуждение исходный текст
Ответ на Patch for fixing a few memory leaks  (Teodor Sigaev <teodor@stack.net>)
Ответы Re: Patch for fixing a few memory leaks  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
>>Tom, I want to notice that initGISTstate is called for every inserting
>>value (for each row). I think it's not good, because this function
>>called 'fmgr_info' 7 times. 'fmgr_info' call a
>>'load_external_function' with execution of sequence search on library
>>name. Any suggestion?
>>
>
> fmgr_info shouldn't be all that expensive; I'm not really inclined to
> worry about it.  Do you have evidence to the contrary?


Tom, I make some test with this ugly patch which makes structure giststate
static (pls, don't commit this patch :) ).

Test:
1. install contrib/btree_gist
2. create 'sql.cmd' file contains:
DROP TABLE tbl;
BEGIN TRANSACTION;
CREATE TABLE tbl (v INT);
CREATE INDEX tblidx ON tbl USING GIST (v);
COPY tbl FROM '/tmp/data';
END TRANSACTION;
3. create /tmp/data with 10000 random values.

Result:
1. Original gist.c
% time psql wow < sql.cmd
psql wow < sql.cmd  0.00s user 0.02s system 0% cpu 7.170 total
2. Patched gist.c
% time psql wow < sql.cmd
psql wow < sql.cmd  0.02s user 0.00s system 2% cpu 0.699 total

We can see that calling fmgr_info for 70000 times may be very expensive.


--
Teodor Sigaev
teodor@stack.net


Вложения

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

Предыдущее
От: Tatsuo Ishii
Дата:
Сообщение: Re: Problem on AIX with current
Следующее
От: "Zeugswetter Andreas SB SD"
Дата:
Сообщение: Re: Problem on AIX with current