From: | nolan(at)celery(dot)tssi(dot)com |
---|---|
To: | swampler(at)noao(dot)edu (Steve Wampler) |
Cc: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Improving a simple query? |
Date: | 2003-07-14 01:23:47 |
Message-ID: | 20030714012347.18920.qmail@celery.tssi.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
> > Could you not rewrite this as a simple join though?
>
> Hmmm, I don't see how. Then again, I'm pretty much the village
> idiot w.r.t. SQL...
>
> The inner select is locating a set of (2049) ids (actually from
> the same table, since 'attributes' is just a view into
> 'attributes_table'). The outer select is then locating all
> records (~30-40K) that have any of those ids. Is that really
> something a JOIN could be used for?
This may be a question for SQL theoretists, but I don't think I've ever
run across a query with a 'where in' clause that couldn't be written
as a join. I think linguistically 'where in' may even be a special
case of 'join'.
Yet another question for the theoretists: Would it be possible to optimize
a 'where in' query by rewriting it as a join?
--
Mike Nolan
From | Date | Subject | |
---|---|---|---|
Next Message | Chris Bowlby | 2003-07-14 02:31:01 | Re: Improving a simple query? |
Previous Message | Hannu Krosing | 2003-07-13 23:58:28 | Re: Improving a simple query? |