×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
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.
What is you did the following instead:
from SCHEDACTVIEW join ACCOUNTVIEWon SCHEDACTVIEW.RECORD_ID=ACCOUNTVIEW.RECORD_ID
> and SCHEDACTVIEW.ACCOUNT_ID=ACCOUNTVIEW.ACCOUNT_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.