Обсуждение: ERROR: Memory exhausted in AllocSetAlloc(188)

Поиск
Список
Период
Сортировка

ERROR: Memory exhausted in AllocSetAlloc(188)

От
Tilo Schwarz
Дата:
Dear Postgresql gurus,

some time ago I sent a mail to pgsql-general@postgresql.org. For some magic
reason, I couldn't find it in the archives, so I repeat the main point below:

I wrote:

[...snip...]

I have a problem (7.3.1 on linux) with a query eating all my memory.

[...snip...]

tschwarz=# select * from feature_point_delta_avg where sequence_id
=325058;

(waiting for ca. 10 minutes)

ERROR:  Memory exhausted in AllocSetAlloc(188)

Tom replied:

You didn't tell us much about the functions involved in these views,
but I suspect the problem has to do with the fact that you're passing
whole-row references (foo.*) to the functions.  The mechanism for
handling whole-row references is horrid --- it leaks memory that isn't
reclaimed till end of query.  We need to redesign it someday.  In the
meantime, try passing just the columns you need, explicitly.


Now I had time to verify this - and Tom was right. After passing the columns
explicitly, the problem disappears. Because I need > 20 columns in my
function, the code (using $1 ... $20) becomes pretty ugly, so I'm happy to
see this point on the TODO ;-)

Thanks a lot for helping!

    Tilo