Re: 8.3.1 query plan

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Steve Clark <sclark(at)netwolves(dot)com>
Cc: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: 8.3.1 query plan
Date: 2008-08-28 05:12:59
Message-ID: 958.1219900379@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Steve Clark <sclark(at)netwolves(dot)com> writes:
> explain 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)
> )

Consider testing the conditions on A at the top level, instead of
redundantly checking them inside the sub-query on B. I'm not certain
exactly how much that's hurting you (EXPLAIN ANALYZE output would've
been more informative), but it can't be good.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matthew Dennis 2008-08-28 05:30:07 indexes on functions and create or replace function
Previous Message Tom Lane 2008-08-28 04:42:19 Re: strange explain analyze output