pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Memory exhausted
2+ messages / 2 participants
[nested] [flat]

* Memory exhausted
@ 2001-06-11 12:25  David Richter <D.Richter@DKFZ-heidelberg.de>
  0 siblings, 1 reply; 2+ messages in thread

From: David Richter @ 2001-06-11 12:25 UTC (permalink / raw)
  To: sg9@sg9.de

Hello!

I used a self written funtion in plpgsql with a database  of 2 Gigabyte
size. My server has 384 Megabytes of RAM.

So I got this error by calling the following function:

psql:restructure.sql:139: FATAL 1:  Memory exhausted in AllocSetAlloc()
pqReadData() -- backend closed the channel unexpectedly.
        This probably means the backend terminated abnormally
        before or while processing the request.
psql:restructure.sql:139: connection to server was lost

In the memory usage program Its shown that the function needs all the
memory.


The function fetches all XXX rows of a table
and writes a value to another table

CREATE FUNCTION series_image () RETURNS integer AS '
        DECLARE 
                        
                psr_rec record;
                i integer := 0;

BEGIN 
        FOR psr_rec IN SELECT * FROM relseries_image000 LOOP
                UPDATE image 
                        SET seriesoid  = psr_rec.parentoid
                        WHERE chilioid = psr_rec.childoid;
                i := i + 1;
        END LOOP;
        IF NOT FOUND THEN RETURN -1; 
                ELSE RETURN i;
        END IF;
END;

' LANGUAGE 'plpgsql';

What could I optimize in this function above?
I tried the Select statement in the psql command and it has taken 20
minutes. I estimate that there are more than 400000 rows in the table.
Then it breakes , the announcment appears: malloc: Resource temporarily
unavailable
and psql is crashed.

Should I change the postmaster parameters?
actually they are :
./postmaster -i -S -D/usr/local/pgsql/data -B 256 -o -e -o -F

What can I do?
Thanks in advance for any advice

David

Attachments:

D.Richter.vcf (text/x-vcard, 467B) download begin:vcard url;quoted-printable:http://mbi.DKFZ-Heidelberg.de/=0D=0A n:M. Richter;David x-mozilla-html:FALSE org:Deutsches Krebsforschungszentrum;Division Medizinische und Biologische Informatik version:2.1 email;internet:d.richter@dkfz-heidelberg.de adr;quoted-printable:;;Im Neuenheimer Feld 280 url: http://mbi.DKFZ-Heidelberg.de/=0D=0AD-69120 Heidelberg, Germany ;Heidelberg;Germany;; x-mozilla-cpt:;-15296 fn:David M. Richter end:vcard
^ permalink raw reply [nested|flat] 2+ messages in thread

* Re: Memory exhausted
@ 2001-06-11 13:56  Tom Lane <tgl@sss.pgh.pa.us>
  parent: David Richter <D.Richter@DKFZ-heidelberg.de>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2001-06-11 13:56 UTC (permalink / raw)
  To: David Richter <D.Richter@DKFZ-heidelberg.de>; +Cc: sg9@sg9.de; pgsql-sql

David Richter <D.Richter@DKFZ-heidelberg.de> writes:
> I used a self written funtion in plpgsql with a database  of 2 Gigabyte
> size. My server has 384 Megabytes of RAM.

> So I got this error by calling the following function:

> psql:restructure.sql:139: FATAL 1:  Memory exhausted in AllocSetAlloc()

Try updating to Postgres 7.1.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2001-06-11 13:56 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-06-11 12:25 Memory exhausted David Richter <D.Richter@DKFZ-heidelberg.de>
2001-06-11 13:56 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox