|
On 3/4/13 12:39 PM, Tom E Stieger wrote:
I'm wondering if this has to do with how your JOIN is defined.> and SCHEDACTVIEW.ACCOUNT_ID=ACCOUNTVIEW.ACCOUNT_ID
What is you did the following instead:
from SCHEDACTVIEW join ACCOUNTVIEWon SCHEDACTVIEW.RECORD_ID=ACCOUNTVIEW.RECORD_ID
> where SCHEDACTVIEW.USER# = ?
It should logically be the same, but due to the UDF I'm not sure if
the optimizer will see it as the same.
Unfortunately, no change: it still runs through the entire file (as
witnessed by the diagnostic version of the censor), and the Visual
Explain looks exactly the same, either way (I'm back on our box).
Ditto if I add "AND SCHEDACTVIEW.RECORD_ID < 999999999" (which would
weed out activities that aren't "account-only," since a RECORD_ID with
more than 9 digits can never be an account) (for more, see below)
It's as if the optimizer itself is fighting me.
Is there some way to refactor this so that it checks whether the USER#
matches *before* it bothers looking for anything else?
**********
> ***I changed this from ACCOUNT_ID b/c I thought it might be a typo***
Actually, there is no RECORD_ID field in ACCOUNTVIEW.
SCHEDACTVIEW.RECORD_ID can be an account ID, a contact ID, or an
account/contact relation ID, which is why we have that 3-branched UNION
ALL in there. SCHEDACTVIEW.ACCOUNT_ID is a separate direct link to the
account (or zero, for activities with a contact but no account)
Which is to say that the SCHEDACTVIEW.ACCOUNT_ID=ACCOUNTVIEW.ACCOUNT_ID
comparison is redundant here. But getting rid of it accomplishes nothing.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.