Re: out of memory woes - Mailing list pgsql-general

From Tom Lane
Subject Re: out of memory woes
Date
Msg-id 17733.1166386165@sss.pgh.pa.us
Whole thread Raw
In response to Re: out of memory woes  ("Angva" <angvaw@gmail.com>)
List pgsql-general
"Angva" <angvaw@gmail.com> writes:
> Here is the sole plpgsql function that was called when the error
> occurred. This function is intended to be called from a shell script in
> order to cluster tables in parallel processes.

OK, I played around with this for a bit, and what I find is that in 8.1,
that SPIExec context is where the sort operation run by CLUSTER's
reindexing step allocates memory.  So the short answer is "you've got
maintenance_work_mem set too high".  I don't know why it sometimes fails
and sometimes not --- maybe you are reaching the swap-space limits of
the machine when you do several of these in parallel?  But there doesn't
seem to be any actual leak here.

BTW, it's also the case that the 8.1 sort code isn't great about
measuring its space usage.  I had maintenance_work_mem set to 100MB
and saw actual process size exceeding 200MB ... IIRC, that's been
improved in 8.2.

            regards, tom lane

pgsql-general by date:

Previous
From: Bob Pawley
Date:
Subject: Creating an Application
Next
From: Gene
Date:
Subject: fedora core 6 startup script for pg 8.2