On Tue, Sep 2, 2008 at 4:19 AM, Ivan Sergio Borgonovo
<[EMAIL PROTECTED]> wrote:


> insert into d (pk, c1, c2, ...) select pk, c1, c2, c3 from s
>  where s.pk not in (select pk from d);

This insert statement might be faster:

INSERT INTO d (pk, c1, c2, ... )
SELECT pk, c1, c2, ...
  FROM s
LEFT JOIN d ON s.pk = d.pk
WHERE d.pk IS NULL;


-- 
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to