Re: MERGE: performance advices
От | Steve Clark |
---|---|
Тема | Re: MERGE: performance advices |
Дата | |
Msg-id | 48BD5750.2050906@netwolves.com обсуждение исходный текст |
Ответ на | Re: MERGE: performance advices ("Richard Broersma" <richard.broersma@gmail.com>) |
Ответы |
Re: MERGE: performance advices
|
Список | pgsql-general |
Richard Broersma wrote: > 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; > > Hello Richard, Is there a way to do something similar with the following? I am an SQL noob and the following takes longer to run than is reasonable, on the order of hours. insert into myevents select * from t_unit_event_log a where exists (select b.event_log_no from myevents b where a.event_status = 1 and a.event_ref_log_no IS NOT NULL and a.event_ref_log_no = b.event_log_no and a.event_log_no not in (select event_log_no from myevents) ) Thanks, Steve
В списке pgsql-general по дате отправления: