Search Postgresql Archives

Re: Out of memory error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 07 Feb 2005 09:32:47 -0800, Joshua D. Drake
<jd@xxxxxxxxxxxxxxxxx> 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;

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux