Re: MERGE: performance advices - Mailing list pgsql-general

From Richard Broersma
Subject Re: MERGE: performance advices
Date
Msg-id 396486430809020538l3728ba9bm1d47674010ecbc31@mail.gmail.com
Whole thread Raw
In response to MERGE: performance advices  (Ivan Sergio Borgonovo <mail@webthatworks.it>)
Responses Re: MERGE: performance advices
List pgsql-general
On Tue, Sep 2, 2008 at 4:19 AM, Ivan Sergio Borgonovo
<mail@webthatworks.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

pgsql-general by date:

Previous
From: Gregory Stark
Date:
Subject: Re: MERGE: performance advices
Next
From: Tony Caduto
Date:
Subject: Re: RAISE NOTICE format in pgAdmin