Re: BUG #5516: Memory grows up problem - Mailing list pgsql-bugs

From Greg Stark
Subject Re: BUG #5516: Memory grows up problem
Date
Msg-id AANLkTimUX91BsPblsNHTxiEYlaDWbOGbncMlz_w5j8WA@mail.gmail.com
Whole thread Raw
In response to BUG #5516: Memory grows up problem  ("Yuhui" <xingyuhui@gmail.com>)
Responses Re: BUG #5516: Memory grows up problem  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Mon, Jun 21, 2010 at 12:41 PM, Yuhui <xingyuhui@gmail.com> wrote:
>
> The following bug has been logged online:
>
> Bug reference: =A0 =A0 =A05516
> Logged by: =A0 =A0 =A0 =A0 =A0Yuhui
> Email address: =A0 =A0 =A0xingyuhui@gmail.com
> PostgreSQL version: 8.3,8.2,8.1
> Operating system: =A0 Linux,Windows
> Description: =A0 =A0 =A0 =A0Memory grows up problem
> Details:
>
> Do the follow setp to reproduce the problem:
> 1,
> CREATE TABLE mem_leak(A INT, B char(50) default 'abcdefg');
> 2,
> INSERT INTO mem_leak(a) VALUES(generate_series(1,200000000));
>
> The memory which the execution process occupation will grows larger and
> larger until all the memory is gone or the process is over or the process=
 is
> killed by the os.

I'm afraid that just how set-returning-functions like
generate_series() worked prior to 8.4. They build a result set in
memory for all their result records.

> If in create table statementthe "B char(50)" is changed to "B varchar(50)"
> or delete the "default 'abcdefg'" the memory will not grow anymore.
>
> The problem is not happen in the 8.4 above version.

There are lots of improvements in each version. Not every one can be
back patched as a bug fix. Definitely not major api changes like this.


--=20
greg

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bug in PL/pgSQL FOR cursor variant
Next
From: Tom Lane
Date:
Subject: Re: BUG #5516: Memory grows up problem