How do we want CC list or commenter "does not match" to work??
Joel Peshkin
bugreport at peshkin.net
Sat Feb 7 16:03:16 UTC 2004
Bradley Baetz wrote:
> <snip>
>
>Now, theres a problem with the above. That assumes that we know the
>userid of the person we're looking for. Lets assume that we don't:
>
>bbaetz=> explain analyze select bug_id from bugs where bug_id not in
>(select bug_id from cc where who = (SELECT userid FROM profiles where
>login_name='QJEYECRS'));
>Time: 261.747 ms
>
>The best I can come up with without subselects is:
>
>bbaetz=> explain analyze select bugs.bug_id from bugs left join cc on
>bugs.bug_id=cc.bug_id left join profiles on cc.who = profiles.userid and
>profiles.login_name='QJEYECRS' group by bugs.bug_id having
>count(login_name) = 0;
>Time: 30372.595 ms
>
>which swaps heavily. I don't think that that can be reliably extended to
>include other constraints.
>
>
>
It may not be quite that bad. Search.pm already uses distinct and
avoids joining the profiles when it can by querying the profiles first
and returning either a userid or a list of userids. That could make a
substantial difference.
More information about the developers
mailing list