Re: out of memory for query result

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: out of memory for query result
Дата
Msg-id 20051022201015.GG16589@svana.org
обсуждение исходный текст
Ответ на out of memory for query result  (Allen <dba@girders.org>)
Ответы Re: out of memory for query result  (Allen Fair <allen@cyberdesk.com>)
Список pgsql-general
On Sat, Oct 22, 2005 at 03:46:18PM -0400, Allen wrote:
> I am trying to select a result set from a 2-table join, which should be
> returning 5,045,358 rows. I receive this error:
>
>     DBD::Pg::st execute failed: out of memory for query result

AFAIK, DBD:Pg never uses a cursor unless you ask it to. So you probably
want to code a loop like:

DECLARE CURSOR blah AS ...
while( FETCH 1000 )
{
  process rows...
}

If you don't use a cursor in the backend, then DBI will try to pull the
*entire* result and store it in memory, which is why you don't have
enough...

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Вложения

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

Предыдущее
От: Franck Coppola
Дата:
Сообщение: Re: How to cluster Postgresql
Следующее
От: Steve V
Дата:
Сообщение: Transaction IDs not the same in same transaction?