From: | "Diehl, Jeffrey" <jdiehl(at)sandia(dot)gov> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org |
Cc: | "Diehl, Jeffrey" <jdiehl(at)sandia(dot)gov> |
Subject: | Help with query. (*) |
Date: | 2001-01-16 20:42:45 |
Message-ID: | B51F0C636E578A4E832D3958690CD73E0130BD9A@es04snlnt |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-sql |
I'm having difficulty writing a query which I really can't live without...
I need to get a list of records from table A for which there are
corresponding records in table B. I've tried to use the intersect clause,
but it doesn't seem to work, or it runs far too long. For example:
select * from A
where 1=1
intersect select * from A where
B.x=A.x
and A.y=B.y
and A.z=B.z
limit 100
I need the most efficient method possible; my A tables have upward of 5
Million records. The B table, btw, only has about 100 records.
Any help will be most appreciated.
From | Date | Subject | |
---|---|---|---|
Next Message | Diehl, Jeffrey | 2001-01-16 20:46:57 | Query from multiple tables... |
Previous Message | Adam Haberlach | 2001-01-16 20:22:28 | Re: Spot the error in my plpgsql... |
From | Date | Subject | |
---|---|---|---|
Next Message | Diehl, Jeffrey | 2001-01-16 20:46:57 | Query from multiple tables... |
Previous Message | Jan Wieck | 2001-01-16 19:33:03 | Re: Re: [SQL] improve performance |