Re: Out of memory error - Mailing list pgsql-general

From Clodoaldo Pinto
Subject Re: Out of memory error
Date
Msg-id [email protected]
Whole thread Raw
In response to Re: Out of memory error  ("Joshua D. Drake" <[email protected]>)
Responses Re: Out of memory error
List pgsql-general
On Mon, 07 Feb 2005 09:32:47 -0800, Joshua D. Drake
<[email protected]> 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;

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Creating an index-type for LIKE '%value%'
Next
From: Bruno Wolff III
Date:
Subject: Re: Sorting when "*" is the initial character