| From: | "Aaron Bono" <postgresql(at)aranya(dot)com> |
|---|---|
| To: | "Richard Broersma Jr" <rabroersma(at)yahoo(dot)com> |
| Cc: | "Exner, Peter" <Exner(at)his(dot)de>, "SQL Postgresql List" <pgsql-sql(at)postgresql(dot)org> |
| Subject: | Re: How to find entries missing in 2nd table? |
| Date: | 2006-07-13 16:25:03 |
| Message-ID: | bf05e51c0607130925u12635434v98d877a7f1eb449a@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
On 7/13/06, Richard Broersma Jr <rabroersma(at)yahoo(dot)com> wrote:
>
> > > SELECT controller_id FROM control
> > > WHERE controller_id NOT IN
> > > (SELECT DISTINCT controller_id FROM datapack);
> > The DISTINCT is not necessary. I have heard with Oracle that DISTINCT
> is a
> > huge performance problem. Is that true on PostgreSQL also?
>
> From my experience, it does not preform as well as the standard group by
> clause. I noticed a ~20%
> increase in query run times.
So in that case this would be better:
SELECT controller_id FROM control
WHERE controller_id NOT IN
(SELECT controller_id FROM datapack);
or
SELECT controller_id FROM control
WHERE controller_id NOT IN
(SELECT controller_id FROM datapack GROUP BY controller_id);
Guess you need to do some explain plans to see which would be best.
Good luck!
==================================================================
Aaron Bono
Aranya Software Technologies, Inc.
http://www.aranya.com
==================================================================
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Richard Broersma Jr | 2006-07-13 16:33:52 | Re: How to find entries missing in 2nd table? |
| Previous Message | Richard Broersma Jr | 2006-07-13 16:16:51 | Re: How to find entries missing in 2nd table? |