Re: Out of memory error

From: Clodoaldo Pinto <clodoaldo(dot)pinto(at)gmail(dot)com>
To: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
Cc: postgres general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Out of memory error
Date: 2005-02-07 21:41:54
Message-ID: a595de7a0502071341d642a1e@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 07 Feb 2005 09:32:47 -0800, Joshua D. Drake
<jd(at)commandprompt(dot)com> wrote:
>
> >
> > Any advice on how to avoid it?
>
> Use a cursor.
>
Same thing using a cursor:

declare
rdata record;
begin
truncate table usuarios2;
for rdata in
select distinct on (data) data
from usuarios
loop
insert into usuarios2
(
data,
usuario,
pontos,
wus
)
select
data,
usuario,
sum(pontos),
sum(wus)
from usuarios
where data = rdata.data
group by data, usuario
;
end loop;
return;
end;

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2005-02-07 21:51:46 Re: Out of memory error
Previous Message Martijn van Oosterhout 2005-02-07 21:40:40 Re: Creating an index-type for LIKE '%value%'