Re: BUG #14078: Excessive memory growth during nested loop in select

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #14078: Excessive memory growth during nested loop in select
Дата
Msg-id 5559.1460495739@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #14078: Excessive memory growth during nested loop in select  (psuderevsky@gmail.com)
Список pgsql-bugs
psuderevsky@gmail.com writes:
> [ query producing a 46-million-row join result ]

> Observing amount of memory consumed by psql process with pmap utility...
> So about 8Gb of linux virtual memory has been allocated for join of two
> tables with sizes of 11MB.
> The question is why so high amount of virtual memory is consumed, isn't it
> a memory leak.

No, it's just a very large query result.  psql collects the entire query
result into memory before printing any of it, so that it can format the
result nicely.  If you're dealing with query results large enough for that
to be a problem, you could consider using psql's FETCH_COUNT variable to
make it fetch and format a smaller number of rows at a time; which would
trade off the niceness of the formatting for less memory usage.

            regards, tom lane

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Repeated requests for feedback in logical standby
Следующее
От: Christoph Berg
Дата:
Сообщение: Bus error in pg_logical_slot_get_changes (9.4.7, sparc)