On Tue, Sep 2, 2008 at 4:19 AM, Ivan Sergio Borgonovo
<mail(at)webthatworks(dot)it> 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