Re: Inserting data of two other tables - Mailing list pgsql-novice

From Manfred Koizar
Subject Re: Inserting data of two other tables
Date
Msg-id fesscvo788pb6v8908s9ppahaalc4erogm@4ax.com
Whole thread Raw
In response to Inserting data of two other tables  (papapep <papapep@gmx.net>)
Responses Re: Inserting data of two other tables [Now deleting ...]
List pgsql-novice
On Fri, 23 May 2003 20:45:32 +0200, papapep <papapep@gmx.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

pgsql-novice by date:

Previous
From: papapep
Date:
Subject: Inserting data of two other tables
Next
From: Tom Lane
Date:
Subject: Re: Inserting data of two other tables