Re: [GENERAL] 8.3.1 query plan

2008-08-29 Thread Steve Clark
Tom Lane wrote: Steve Clark <[EMAIL PROTECTED]> writes: Tom Lane wrote: Consider testing the conditions on A at the top level, instead of redundantly checking them inside the sub-query on B. Thanks for the response Tom, I am a SQL neophyte, so I'll try to rework the query. What I meant

Re: [GENERAL] 8.3.1 query plan

2008-08-28 Thread Tom Lane
Steve Clark <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> Consider testing the conditions on A at the top level, instead of >> redundantly checking them inside the sub-query on B. > Thanks for the response Tom, I am a SQL neophyte, so I'll try to > rework the query. What I meant to suggest was

Re: [GENERAL] 8.3.1 query plan

2008-08-28 Thread Steve Clark
Tom Lane wrote: Steve Clark <[EMAIL PROTECTED]> 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_lo

Re: [GENERAL] 8.3.1 query plan

2008-08-27 Thread Tom Lane
Steve Clark <[EMAIL PROTECTED]> 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

Re: [GENERAL] 8.3.1 query plan

2008-08-27 Thread Steve Clark
Martijn van Oosterhout wrote: On Wed, Aug 27, 2008 at 11:00:54AM -0400, Steve Clark wrote: So I did an explain and I see it is doing a seq scan in the last sub plan - there are about 375,000 rows in myevent - why isn't it using the index instead of doing a seq scan? create unique index indx1m

Re: [GENERAL] 8.3.1 query plan

2008-08-27 Thread Martijn van Oosterhout
On Wed, Aug 27, 2008 at 11:00:54AM -0400, Steve Clark wrote: > So I did an explain and I see it is doing a seq scan in the last sub plan - > there are about 375,000 rows > in myevent - why isn't it using the index instead of doing a seq scan? > > create unique index indx1myevents on myevents (eve