Re: Out of memory error

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

Clodoaldo Pinto wrote:
> 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:

Well your first email didn't explain that you were doing the below :)
The cursor will help you with large data pulls from a select.
However you aren't doing a simple select. You are doing an insert into
with a select as your data source.

>
> 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;

Is this the entire function?

Sincerely,

Joshua D. Drake

--
Command Prompt, Inc., your source for PostgreSQL replication,
professional support, programming, managed services, shared
and dedicated hosting. Home of the Open Source Projects plPHP,
plPerlNG, pgManage, and pgPHPtoolkit.
Contact us now at: +1-503-667-4564 - http://www.commandprompt.com

Attachment Content-Type Size
jd.vcf text/x-vcard 640 bytes

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2005-02-07 22:02:54 PHP/PDO Database Abstraction Layer
Previous Message Clodoaldo Pinto 2005-02-07 21:41:54 Re: Out of memory error