Re: [GENERAL] best way to query

2008-01-25 Thread Tom Lane
Steve Clark <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> Also, whatever is the ORDER BY for? > without the order by it wants to do a seq scan of t_unit_event_log. > see below: > explain select count(*) from t_event_ack_log where event_log_no not > in (select event_log_no from t_unit_event_l

Re: [GENERAL] best way to query

2008-01-25 Thread Steve Clark
Tom Lane wrote: Steve Clark <[EMAIL PROTECTED]> writes: Tom Lane wrote: Also, whatever is the ORDER BY for? without the order by it wants to do a seq scan of t_unit_event_log. see below: explain select count(*) from t_event_ack_log where event_log_no not in (select event_log_no from t_u

Re: [GENERAL] best way to query

2008-01-25 Thread Steve Clark
Daniel Verite wrote: Steve Clark wrote: any way i have 2 table - A and B. each table has a key field and if a row is in B it should have a corresponding row in A - but theres the problem it doesn't for all the rows in B. So I want to do something like delete from B where key not in

Re: [GENERAL] best way to query

2008-01-25 Thread Daniel Verite
Steve Clark wrote: any way i have 2 table - A and B. each table has a key field and if a row is in B it should have a corresponding row in A - but theres the problem it doesn't for all the rows in B. So I want to do something like delete from B where key not in (select key from A orde

Re: [GENERAL] best way to query

2008-01-25 Thread Steve Clark
Tom Lane wrote: Steve Clark <[EMAIL PROTECTED]> writes: explain shows: Aggregate (cost=4712921585.30..4712921585.31 rows=1 width=0) -> Seq Scan on t_event_ack_log a (cost=103170.29..4712920878.60 rows=282677 width=0) Filter: (NOT (subplan)) SubPlan ->

Re: [GENERAL] best way to query

2008-01-25 Thread Tom Lane
Steve Clark <[EMAIL PROTECTED]> writes: > explain shows: > Aggregate (cost=4712921585.30..4712921585.31 rows=1 width=0) > -> Seq Scan on t_event_ack_log a (cost=103170.29..4712920878.60 > rows=282677 width=0) > Filter: (NOT (subplan)) > SubPlan > -> Mater

[GENERAL] best way to query

2008-01-25 Thread Steve Clark
Hello List, this is a noobie question: I have had to take over an existing system - it was supposed to have some contraints that prevented dangling references - but... any way i have 2 table - A and B. each table has a key field and if a row is in B it should have a corresponding row in A -