Re: Inserting data of two other tables

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: papapep <papapep(at)gmx(dot)net>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Inserting data of two other tables
Date: 2003-05-23 19:14:59
Message-ID: fesscvo788pb6v8908s9ppahaalc4erogm@4ax.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Fri, 23 May 2003 20:45:32 +0200, papapep <papapep(at)gmx(dot)net> wrote:
>INSERT INTO totaltrajectes ([...])
>SELECT [...]
>FROM captrajectes,detalltrajectes
>
>Also I have to mention that this sentence works with about 650.000 rows
>~ in the table "detalltrajectes" and
>35.000 in the "captrajectes" one.

>Does anybody know a more effective way to fill the new table?

Yes. Use a WHERE clause :-) Your join produces 650000 * 35000 rows.
This should work:

... FROM captrajectes AS c, detalltrajectes AS d
WHERE c.pkey = d.journey;

Servus
Manfred

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2003-05-23 19:31:40 Re: Inserting data of two other tables
Previous Message papapep 2003-05-23 18:45:32 Inserting data of two other tables