Copy codeThe Code is as follows:
Select a. f_username
From
(
SELECT/* + parallel (gu, 4) */distinct gu. f_username
FROM t_base_succprouser gu
Where gu. f_expectenddate> (select trunc (sysdate, 'y') from dual)
And gu. f_lotid = 1
And gu. f_playid = 4
And gu. f_paymoney >=1500
)
Left join
(
Select
From t_base_vip_customes
And (vu. f_passeddate is null) or (vu. f_passeddate> trunc (sysdate, 'y ')))
And (vu. f_lotid is null) or (vu. f_lotid = 1 ))
And (vu. f_playid is null) or (vu. f_playid = 4 ))
And (vu. f_condtionid is null) or (vu. f_condtionid = 3 ))
) B
On A. f_username = B. f_usernam
Where B. f_username is null
Only some users can be identified using the following statement
Copy codeThe Code is as follows:
SELECT/* + parallel (gu, 4) */distinct gu. f_username
FROM t_base_succprouser gu
Left join t_base_vip_customes VU on gu. f_username = vu. f_username
Gu. f_expectenddate> (select trunc (sysdate, 'y') from dual)
And gu. f_lotid = rec_viplotplay.f_lotid
And gu. f_playid = rec_viplotPlay.f_Playid
And gu. f_paymoney> = rec_viplotPlay.F_Conditon_ValuesA
And (vu. f_passeddate is null) or (vu. f_passeddate> trunc (sysdate, 'y ')))
And (vu. f_lotid is null) or (vu. f_lotid = rec_viplotplay.f_lotid ))
And (vu. f_playid is null) or (vu. f_playid = rec_viplotPlay.f_Playid ))
And (vu. f_condtionid is null) or (vu. f_condtionid = rec_viplotPlay.F_CondtionID ))
And vu. f_username is null
Execution Plan:
Copy codeThe Code is as follows:
Select statement, GOAL = ALL_ROWS
HASH UNIQUE
NESTED LOOPS OUTER
PARTITION RANGE ALL
Table access full Object name = T_BASE_SUCCPROUSER
VIEW
FILTER
Table access full Object name = T_BASE_VIP_CUSTOMES
FAST DUAL
Later, I changed it to the following to check it out.
Copy codeThe Code is as follows:
SELECT/* + parallel (gu, 4) */distinct gu. f_username
FROM t_base_succprouser gu
Left join t_base_vip_customes VU on gu. f_username = vu. f_username
And (vu. f_passeddate is null) or (vu. f_passeddate> trunc (sysdate, 'y ')))
And (vu. f_lotid is null) or (vu. f_lotid = rec_viplotplay.f_lotid ))
And (vu. f_playid is null) or (vu. f_playid = rec_viplotPlay.f_Playid ))
And (vu. f_condtionid is null) or (vu. f_condtionid = rec_viplotPlay.F_CondtionID ))
Where gu. f_expectenddate> (select trunc (sysdate, 'y') from dual)
And gu. f_lotid = rec_viplotplay.f_lotid
And gu. f_playid = rec_viplotPlay.f_Playid
And gu. f_paymoney> = rec_viplotPlay.F_Conditon_ValuesA
And vu. f_username is null
Execution Plan:
Select statement, GOAL = ALL_ROWS
HASH UNIQUE
FILTER
NESTED LOOPS OUTER
Table access by global index rowid Object name = T_BASE_SUCCPROUSER
Index range scan Object name = IX_BASE_PROUSER_LOWEX
FAST DUAL
VIEW
Table access full Object name = T_BASE_VIP_CUSTOMES
Oracle doesn't understand how to filter out the data and connect to it first? Too stupid! In this way, the qualified data is also filtered out.