Hi, I have a query which part of a SP which is executed fairly regularly, and the query took a while to execute, so I decided to have a look at it. I did an autotrace on the query, and this was the execution plan returned [ pasted in pastebin due to excessive size ]
I added indexes on the tables which was undergoing full table access, and ran the query. The query performance was worse then before, despite the cost being significantly lower.
Why is this so, can anyone shed a light on the same ?
The database is an Oracle 10gR2 ( Release 10.2.0.1.0 ).
This is the query being run
SELECT DISTINCT CAC_FLEX_03, CAC_FLEX_04
FROM PCOM_CUST_PRACTICE_INFO A,
PGIM_ZIP_CODES C,
PGIM_PROD_TARIFF_DATA B,
PCOM_CODES_APPL_CODES D
WHERE A.PCPI_CUST_CODE IN ('002023', '002025')
AND C.ZC_ZIP_CODE = A.PCPI_PIN_CODE
AND C.ZC_CITY_CODE = A.PCPI_CITY
AND C.ZC_COUNTY_CODE = A.PCPI_COUNTY
AND C.ZC_STATE_CODE = A.PCPI_STATE
AND B.PTD_CVR_CODE = 'TF-001'
AND B.PTD_VALUE_SET2 = A.PCPI_STATE
AND B.PTD_VALUE_SET4 = A.PCPI_COUNTY
AND B.PTD_VALUE_SET5 = D.CAC_FLEX_03
AND D.CAC_FLEX_04 IS NOT NULL
AND ZC_STATE_CODE =
(SELECT POL_FLEX_04
FROM PGIT_POLICY
WHERE POL_SYS_ID = 541332)
AND B.PTD_VALUE_SET3 =
(SELECT POL_FLEX_01
FROM PGIT_POLICY
WHERE POL_SYS_ID = 541332)
AND CAC_TYPE = 'TERR-CODE'
AND CAC_FLEX_03 = 0;