Skip site navigation (1) Skip section navigation (2)

Re: 8.3.1 query plan

From: Steve Clark <sclark(at)netwolves(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql <pgsql-general(at)postgresql(dot)org>
Subject: Re: 8.3.1 query plan
Date: 2008-08-28 11:22:52
Message-ID: 48B68A8C.6060404@netwolves.com (view raw or flat)
Thread:
Lists: pgsql-general
Tom Lane wrote:
> 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
> 
> 
Thanks for the response Tom, I am a SQL neophyte, so I'll try to rework the query. The explain analyze
runs forever, or longer than a day anyway.

Regards,
Steve

In response to

Responses

pgsql-general by date

Next:From: Laura Del CaƱoDate: 2008-08-28 11:32:56
Subject: pg_dump problem
Previous:From: Jorge GodoyDate: 2008-08-28 10:57:52
Subject: Re: upgrading from 8.1.4 to 8.3.3

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group