Re: [SQL] Non Matching Records in Two Tables

2006-02-15 Thread Ken Hill
On Tue, 2006-02-14 at 15:05 -0800, Bryce Nesbitt wrote: Ken Hill wrote: >> also (hate to be obvious) have you analyzed lately? >> I'd say that's fair game, not obvious. Vacuum/Analyze is ar so aparent to a person moving to Postgres from other DB's. ---(end of b

Re: [SQL] Non Matching Records in Two Tables

2006-02-14 Thread Bryce Nesbitt
Ken Hill wrote: >> also (hate to be obvious) have you analyzed lately? >> I'd say that's fair game, not obvious. Vacuum/Analyze is ar so aparent to a person moving to Postgres from other DB's. ---(end of broadcast)--- TIP 4: Have you searched

Re: [SQL] Non Matching Records in Two Tables

2006-02-14 Thread Ken Hill
On Tue, 2006-02-14 at 13:24 -0800, Ken Hill wrote: On Tue, 2006-02-14 at 13:08 -0800, chester c young wrote: > Here is my query SQL: > > SELECT key100 FROM ncccr10 > WHERE ncccr10.key100 NOT IN (SELECT key100 FROM ncccr9); > > It is is running after 30 minutes. Here is the query p

Re: [SQL] Non Matching Records in Two Tables

2006-02-14 Thread Ken Hill
On Tue, 2006-02-14 at 16:07 -0500, Tom Lane wrote: Ken Hill <[EMAIL PROTECTED]> writes: > Seq Scan on ncccr10 (cost=0.00..20417160510.08 rows=305782 width=104) >Filter: (NOT (subplan)) >SubPlan > -> Seq Scan on ncccr9 (cost=0.00..65533.71 rows=494471 width=104) > (4 rows) >

Re: [SQL] Non Matching Records in Two Tables

2006-02-14 Thread Ken Hill
On Tue, 2006-02-14 at 13:08 -0800, chester c young wrote: > Here is my query SQL: > > SELECT key100 FROM ncccr10 > WHERE ncccr10.key100 NOT IN (SELECT key100 FROM ncccr9); > > It is is running after 30 minutes. Here is the query plan: > I would try an outer join: select a.key100 from nccc

Re: [SQL] Non Matching Records in Two Tables

2006-02-14 Thread chester c young
> Here is my query SQL: > > SELECT key100 FROM ncccr10 > WHERE ncccr10.key100 NOT IN (SELECT key100 FROM ncccr9); > > It is is running after 30 minutes. Here is the query plan: > I would try an outer join: select a.key100 from ncccr10 a left join ncccr9 b on( key100 ) where b.key100 is null;

Re: [SQL] Non Matching Records in Two Tables

2006-02-14 Thread Tom Lane
Ken Hill <[EMAIL PROTECTED]> writes: > Seq Scan on ncccr10 (cost=0.00..20417160510.08 rows=305782 width=104) >Filter: (NOT (subplan)) >SubPlan > -> Seq Scan on ncccr9 (cost=0.00..65533.71 rows=494471 width=104) > (4 rows) > Any ideas why it is so slow? "NOT (subplan)" is horrendo

Re: [SQL] Non Matching Records in Two Tables

2006-02-14 Thread Ken Hill
On Wed, 2006-02-08 at 22:31 +0100, Markus Schaber wrote: Hi, Ken, Ken Hill schrieb: > I need some help with a bit of SQL. I have two tables. I want to find > records in one table that don't match records in another table based on > a common column in the two tables. Both tables have a column

Re: [SQL] Non Matching Records in Two Tables

2006-02-09 Thread BigSmoke
You can use an EXCEPT clause. ---(end of broadcast)--- TIP 6: explain analyze is your friend

Re: [SQL] Non Matching Records in Two Tables

2006-02-09 Thread Patrick JACQUOT
Ken Hill wrote: I need some help with a bit of SQL. I have two tables. I want to find records in one table that don't match records in another table based on a common column in the two tables. Both tables have a column named 'key100'. I was trying something like: SELECT count(*) FROM table1,

Re: [SQL] Non Matching Records in Two Tables

2006-02-08 Thread Ken Hill
On Wed, 2006-02-08 at 16:27 -0500, Frank Bax wrote: At 04:10 PM 2/8/06, Ken Hill wrote: >I need some help with a bit of SQL. I have two tables. I want to find >records in one table that don't match records in another table based on a >common column in the two tables. Both tables have a colu

Re: [SQL] Non Matching Records in Two Tables

2006-02-08 Thread Owen Jacobson
Ken Hill wrote: > I need some help with a bit of SQL. I have two tables. I want > to find records in one table that don't match records in another > table based on a common column in the two tables. Both tables > have a column named 'key100'. I was trying something like: > > SELECT count(*) > FRO

Re: [SQL] Non Matching Records in Two Tables

2006-02-08 Thread Markus Schaber
Hi, Ken, Ken Hill schrieb: > I need some help with a bit of SQL. I have two tables. I want to find > records in one table that don't match records in another table based on > a common column in the two tables. Both tables have a column named > 'key100'. I was trying something like: > > SELECT cou

Re: [SQL] Non Matching Records in Two Tables

2006-02-08 Thread Frank Bax
At 04:10 PM 2/8/06, Ken Hill wrote: I need some help with a bit of SQL. I have two tables. I want to find records in one table that don't match records in another table based on a common column in the two tables. Both tables have a column named 'key100'. I was trying something like: SELECT co

[SQL] Non Matching Records in Two Tables

2006-02-08 Thread Ken Hill
I need some help with a bit of SQL. I have two tables. I want to find records in one table that don't match records in another table based on a common column in the two tables. Both tables have a column named 'key100'. I was trying something like: SELECT count(*) FROM table1, table2 WHERE (tab