Oracle 9.2
Here is a simple query with an inline view. I don't understand why the explain plan does full table scans 3 times.
With PatView AS
(
SELECT
PATIENT.PAT_ID,
PATIENT.PAT_MRN_ID,
PATIENT.PAT_NAME,
PATIENT.HOME_PHONE,
PATIENT.WORK_PHONE,
PATIENT.CUR_PCP_PROV_ID,
PATIENT.DEATH_DATE,
PATIENT.PAT_STATUS
FROM CLARITY.PATIENT PATIENT
)
Select
PAT_ID,
PAT_MRN_ID
From PatView
Union All
Select
PAT_ID,
PAT_MRN_ID
From PatView
Union All
Select
PAT_ID,
PAT_MRN_ID
From PatView
Eplain Plan.
Operation Object Name Rows Bytes Cost
SELECT STATEMENT Optimizer Mode=CHOOSE 2 M 5226
UNION-ALL
TABLE ACCESS FULL CLARITY.PATIENT 924 K 14 M 1742
TABLE ACCESS FULL CLARITY.PATIENT 924 K 14 M 1742
TABLE ACCESS FULL CLARITY.PATIENT 924 K 14 M 1742
Thought this should do 1 full table scan in the inline View. Does the CBO ignore the inline view? Is it cheaper to do 3 full table scans?
Here is a simple query with an inline view. I don't understand why the explain plan does full table scans 3 times.
With PatView AS
(
SELECT
PATIENT.PAT_ID,
PATIENT.PAT_MRN_ID,
PATIENT.PAT_NAME,
PATIENT.HOME_PHONE,
PATIENT.WORK_PHONE,
PATIENT.CUR_PCP_PROV_ID,
PATIENT.DEATH_DATE,
PATIENT.PAT_STATUS
FROM CLARITY.PATIENT PATIENT
)
Select
PAT_ID,
PAT_MRN_ID
From PatView
Union All
Select
PAT_ID,
PAT_MRN_ID
From PatView
Union All
Select
PAT_ID,
PAT_MRN_ID
From PatView
Eplain Plan.
Operation Object Name Rows Bytes Cost
SELECT STATEMENT Optimizer Mode=CHOOSE 2 M 5226
UNION-ALL
TABLE ACCESS FULL CLARITY.PATIENT 924 K 14 M 1742
TABLE ACCESS FULL CLARITY.PATIENT 924 K 14 M 1742
TABLE ACCESS FULL CLARITY.PATIENT 924 K 14 M 1742
Thought this should do 1 full table scan in the inline View. Does the CBO ignore the inline view? Is it cheaper to do 3 full table scans?