Re: Postgresql out-of-memory error - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Postgresql out-of-memory error
Date
Msg-id 4735.1164124431@sss.pgh.pa.us
Whole thread Raw
In response to Postgresql out-of-memory error  (Joe Malicki <joe.malicki@metacarta.com>)
List pgsql-bugs
Joe Malicki <joe.malicki@metacarta.com> writes:
> I have a query that is aborting because of out of memory,

It looks like you've got a couple of different problems:

> TopTransactionContext: 1548738560 total in 197 blocks; 6008 free (189
> chunks); 1548732552 used

Does the INSERT's target table have foreign key constraints?  The
after-trigger event list would explain bloat in TopTransactionContext.
There is not much you can do about that except to insert fewer rows
per statement --- changing plans won't help.

> ExecutorState: 1325826956 total in 175 blocks; 1191164528 free (11490374
> chunks); 134662428 used

This is curious.  I'm inclined to suspect a memory leak in the tsearch2
functions you're using.  Can you provide a self-contained test case?

> ExecutorState: 318758912 total in 47 blocks; 5853360 free (47 chunks);
> 312905552 used

I believe this is probably memory used by the sort step, so it ought to
be more or less bounded by your work_mem setting.  What have you got
that set to?

            regards, tom lane

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: BUG #2764: Capital letter in tables or columns not
Next
From: Mikko Tiihonen
Date:
Subject: Re: BUG #2768: dates before year 1600 in timestamptz column