Re: Out of memory error

From: Tino Wildenhain <tino(at)wildenhain(dot)de>
To: Clodoaldo Pinto <clodoaldo(dot)pinto(at)gmail(dot)com>
Cc: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, postgres general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Out of memory error
Date: 2005-02-09 12:18:44
Message-ID: 1107951525.13633.76.camel@sabrina.peacock.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Am Montag, den 07.02.2005, 20:05 -0200 schrieb Clodoaldo Pinto:
> On Mon, 07 Feb 2005 13:51:46 -0800, Joshua D. Drake
> <jd(at)commandprompt(dot)com> wrote:
>
> > Well your first email didn't explain that you were doing the below :)
>
> In the first email I was not doing the insert. I was executing a psql script:
>
> $ psql -e -f groupdup.psql ks2
>
> This was the groupdup.psql script:
>
> \pset format unaligned
> \pset fieldsep '\t'
> \pset tuples_only
> \o '/KakaoStats/bak/groupdup.txt'
> select
> data,
> usuario,
> sum(pontos),
> sum(wus)
> from usuarios
> group by data, usuario
> ;
> \o
> \pset tuples_only
> \pset format aligned
>
> I was planning to insert the file with copy from.

Will this go into the same database?
If so, you should probably use:

CREATE TABLE targettable AS
select data,
usuario,
sum(pontos) as sum_pontos,
sum(wus) as sum_wus
from usuarios
group by data, usuario;

If you are going to insert this into another database,
consider doing the step above and then use

pg_dump -t targettable to get a nice dump you can easily
restore. You can also use copy to dump your own.

HTH
Tino

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Clodoaldo Pinto 2005-02-09 12:39:00 Re: Out of memory error
Previous Message Clodoaldo Pinto 2005-02-09 11:31:59 Re: Out of memory error