Re: Patch for fixing a few memory leaks

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Teodor Sigaev <teodor(at)stack(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Patch for fixing a few memory leaks
Date: 2001-10-06 23:25:47
Message-ID: 7624.1002410747@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Teodor Sigaev <teodor(at)stack(dot)net> writes:
>>> 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?

> 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.

Okay, I've done something about this: fmgr_info results for index
support functions are now kept in the relcache. I now get roughly
the same timings for loading 10000 tuples into either a plain
btree index or a btree_gist index, rather than a factor-of-7 penalty
for btree_gist as before ...

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Brent Verner 2001-10-06 23:49:32 Re: ALTER RENAME and indexes
Previous Message forth 2001-10-06 23:14:39 How to add a new encoding support?