Re: Memory usage on subselect

From: "Alexander M(dot) Pravking" <fduch(at)antar(dot)bryansk(dot)ru>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Memory usage on subselect
Date: 2004-05-23 18:32:49
Message-ID: 20040523183249.GC54296@dyatel.antar.bryansk.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Sun, May 23, 2004 at 12:28:18PM -0400, Tom Lane wrote:
> "Alexander M. Pravking" <fduch(at)antar(dot)bryansk(dot)ru> writes:
> > I've got a memory usage problem when I try to do a subselect on the same
> > table as the main select (PostgreSQL 7.3.4 on FreeBSD). Here's my query:
> > ...
> > The "services" table is indexed only on "id" column and has about a
> > thousand tuples. sreq(integer, text, timestamptz) is a strict immutable
> > function written in SQL.
>
> IIRC, there were intraquery memory leaks associated with SQL-language
> functions until fairly recently. Can you try your problem case on 7.4?
> Or see if you can rewrite the sreq function in plpgsql.

Thanks, Tom, both 7.4.1 and plpgsql function on 7.3.4 work well. However,
plpgsql function is a little slower, but that's another story.

I also tried to turn off IMMUTABLE for the function, but it did not
affect memory usage on 7.3.4.

BTW, after cancelling the original query postgres freed all the memory,
and used ~7M again, so the leak was not "forever".

Good luck, thansk again ;)

--
Fduch M. Pravking

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Dan Field 2004-05-24 08:53:24 Re: Memory usage on subselect
Previous Message Tom Lane 2004-05-23 16:28:18 Re: Memory usage on subselect