The identical query, unusable performance in an environment - please help

We strive to improve 10.2.0.4 to 11.2.0.2, but one of our considered requests is completely wrong (30 seconds in our current environment, 4000 in our upgraded environment).

Note that the caveat is that it will be very difficult for me to edit the SQL code (his coming of another group of TI, as well as their position is that he should not have to be changed given the fact that it works so well in the current production environment).

The query is exactly the same in both environments and transports the SQL_ID, but explain the plans are different.

The environment in which the application works is version 10.2.0.4 and time the trace is 30,15 seconds, 841 rows returned.
The new environment is 11.2.0.2, the elapsed time is 4035 seconds, 841 rows returned.

The environments are comparable in terms of CPU/memory/IO (the two are written for on our NetApp NFS mounts)

SGA_MAX/TARGET and PGA_AGGREGATE_TARGET are the same in both environments, as well as HASH_AREA_SIZE and SORT_AREA_SIZE.

The table database is identical, and all of the indexes are the same in both environments. His stats were collected and this behavior has persisted through several reboots of the databases.

I ran traces on statements in both environments and the performance difference seems to be due to direct path read/write temp:

The SQL
SELECT DISTINCT
         a.emplid,
         a.name,
         rds.sa_get_stdnt_email_fn (a.emplid),
         a.req_term,
         a.req_term_ldesc,
         CASE
            WHEN (a.req_acad_plan = 'PKINXXXBBS' AND a.cum_gpa >= d.gpa)
            THEN
               NVL (c.num_met, 0) + 1
            WHEN (b.gpa >= d.gpa AND a.req_acad_plan <> 'PKINXXXBBS')
            THEN
               NVL (c.num_met, 0) + 1
            ELSE
               NVL (c.num_met, 0)
         END
            AS "Requirement Status",
         a.cum_total_passed AS "Cumulative Units",
         a.admit_term,
         a.admit_term_ldesc,
         a.acad_plan,
         a.acad_plan_ldesc,
         a.academic_level,
         a.academic_level_ldesc,
         TO_CHAR (a.rpt_date, 'MM/DD/YYYY') AS rpt_date,
         TO_CHAR (NVL (b.gpa, 0), '0.000') AS gpa,
         TO_CHAR (NVL (a.cum_gpa, 0), '0.000') AS cum_gpa
    FROM sa.rec_sm_stdnt_deg_completion a,
         (  SELECT DISTINCT
                   CASE
                      WHEN SUM (b_sub.units_earned) = 0 THEN 0
                      ELSE SUM (b_sub.grade_points) / SUM (b_sub.units_earned)
                   END
                      AS gpa,
                   b_sub.emplid,
                   b_sub.acad_career,
                   b_sub.acad_plan,
                   b_sub.req_acad_plan,
                   b_sub.req_term,
                   b_sub.academic_level,
                   b_sub.rqrmnt_group
              FROM sa.rec_sm_stdnt_deg_completion b_sub,
                   hrsa_extr.ps_rq_grp_tbl g3,
                   hrsa_extr.ps_rq_main_tbl m3
             WHERE     b_sub.req_acad_plan IS NOT NULL
                   AND b_sub.acad_career = 'UGRD'
                   AND b_sub.acad_prog = 'UBACH'
                   AND b_sub.acad_plan = b_sub.req_acad_plan
                   AND b_sub.grade <> 'IP'
                   AND b_sub.impact_flag = 'Y'
                   AND g3.effdt =
                          (SELECT MAX (g3_ed.effdt)
                             FROM hrsa_extr.ps_rq_grp_tbl g3_ed
                            WHERE     g3_ed.rqrmnt_group = g3.rqrmnt_group
                                  AND g3_ed.effdt <= b_sub.req_term_begin_date)
                   AND g3.rqrmnt_group = b_sub.rqrmnt_group
                   AND m3.effdt =
                          (SELECT MAX (m3_ed.effdt)
                             FROM hrsa_extr.ps_rq_main_tbl m3_ed
                            WHERE     m3_ed.requirement = m3.requirement
                                  AND m3_ed.effdt <= b_sub.req_term_begin_date)
                   AND m3.requirement = b_sub.requirement
          GROUP BY b_sub.emplid,
                   b_sub.acad_career,
                   b_sub.acad_plan,
                   b_sub.req_acad_plan,
                   b_sub.req_term,
                   b_sub.academic_level,
                   b_sub.rqrmnt_group) b,
         (  SELECT c_sub.emplid,
                   c_sub.acad_career,
                   c_sub.acad_plan,
                   c_sub.req_acad_plan,
                   c_sub.req_term,
                   c_sub.academic_level,
                   c_sub.rqrmnt_group,
                   COUNT (*) AS num_met
              FROM sa.rec_sm_stdnt_deg_completion c_sub,
                   hrsa_extr.ps_rq_grp_tbl g2,
                   hrsa_extr.ps_rq_main_tbl m2
             WHERE     c_sub.rqrmnt_line_status = 'COMP'
                   AND c_sub.grade <> 'IP'
                   AND c_sub.impact_flag = 'Y'
                   AND c_sub.acad_career = 'UGRD'
                   AND c_sub.acad_prog = 'UBACH'
                   AND c_sub.acad_plan = c_sub.req_acad_plan
                   AND g2.effdt =
                          (SELECT MAX (g2_ed.effdt)
                             FROM hrsa_extr.ps_rq_grp_tbl g2_ed
                            WHERE     g2_ed.rqrmnt_group = g2.rqrmnt_group
                                  AND g2_ed.effdt <= c_sub.req_term_begin_date)
                   AND g2.rqrmnt_group = c_sub.rqrmnt_group
                   AND m2.effdt =
                          (SELECT MAX (m2_ed.effdt)
                             FROM hrsa_extr.ps_rq_main_tbl m2_ed
                            WHERE     m2_ed.requirement = m2.requirement
                                  AND m2_ed.effdt <= c_sub.req_term_begin_date)
                   AND m2.requirement = c_sub.requirement
          GROUP BY c_sub.emplid,
                   c_sub.acad_career,
                   c_sub.acad_plan,
                   c_sub.req_acad_plan,
                   c_sub.req_term,
                   c_sub.academic_level,
                   c_sub.rqrmnt_group) c,
         hrsa_extr.ps_smo_rdr_imp_pln d,
         hrsa_extr.ps_rq_grp_tbl g,
         hrsa_extr.ps_rq_main_tbl m
   WHERE     a.acad_career = 'UGRD'
         AND a.acad_prog = 'UBACH'
         AND a.req_acad_plan IN (N'NUPPXXXBBS', N'NURPBASBBS', N'NURPXXXBBS')
         AND a.academic_level IN (N'10', N'20', N'30', N'40', N'50', N'GR')
         AND a.acad_plan = a.req_acad_plan
         AND a.impact_flag = 'Y'
         AND g.effdt =
                (SELECT MAX (g_ed.effdt)
                   FROM hrsa_extr.ps_rq_grp_tbl g_ed
                  WHERE     g_ed.rqrmnt_group = g.rqrmnt_group
                        AND g_ed.effdt <= a.req_term_begin_date)
         AND g.rqrmnt_group = a.rqrmnt_group
         AND m.effdt =
                (SELECT MAX (m_ed.effdt)
                   FROM hrsa_extr.ps_rq_main_tbl m_ed
                  WHERE     m_ed.requirement = m.requirement
                        AND m_ed.effdt <= a.req_term_begin_date)
         AND m.requirement = a.requirement
         AND a.emplid = b.emplid(+)
         AND a.acad_career = b.acad_career(+)
         AND a.acad_plan = b.acad_plan(+)
         AND a.req_acad_plan = b.req_acad_plan(+)
         AND a.academic_level = b.academic_level(+)
         AND a.req_term = b.req_term(+)
         AND a.rqrmnt_group = b.rqrmnt_group(+)
         AND a.emplid = c.emplid(+)
         AND a.acad_career = c.acad_career(+)
         AND a.acad_plan = c.acad_plan(+)
         AND a.req_acad_plan = c.req_acad_plan(+)
         AND a.academic_level = c.academic_level(+)
         AND a.req_term = c.req_term(+)
         AND a.rqrmnt_group = c.rqrmnt_group(+)
         AND d.acad_plan = a.req_acad_plan
ORDER BY 6 DESC, 2 ASC;
New environment (11.2.0.2), takes 4000 seconds according to tkprof

Explain plan
PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------------------------------------------------
Plan hash value: 4117596694

-------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                                 | Name                        | Rows  | Bytes | Cost (%CPU)| Time     |
-------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                          |                             |     1 |   314 | 15231   (1)| 00:03:03 |
|   1 |  SORT UNIQUE                              |                             |     1 |   314 | 15230   (1)| 00:03:03 |
|   2 |   NESTED LOOPS OUTER                      |                             |     1 |   314 | 15227   (1)| 00:03:03 |
|   3 |    NESTED LOOPS OUTER                     |                             |     1 |   285 | 15216   (1)| 00:03:03 |
|   4 |     NESTED LOOPS                          |                             |     1 |   256 | 15205   (1)| 00:03:03 |
|   5 |      NESTED LOOPS                         |                             |     1 |   241 | 15204   (1)| 00:03:03 |
|   6 |       NESTED LOOPS                        |                             |     1 |   223 | 15203   (1)| 00:03:03 |
|   7 |        NESTED LOOPS                       |                             |    17 |   731 | 15186   (1)| 00:03:03 |
|   8 |         VIEW                              | VW_SQ_3                     |   998 | 27944 | 15186   (1)| 00:03:03 |
|   9 |          HASH GROUP BY                    |                             |   998 | 62874 | 15186   (1)| 00:03:03 |
|  10 |           MERGE JOIN                      |                             | 29060 |  1787K| 15184   (1)| 00:03:03 |
|  11 |            SORT JOIN                      |                             |    26 |  1248 | 15180   (1)| 00:03:03 |
|  12 |             TABLE ACCESS BY INDEX ROWID   | REC_SM_STDNT_DEG_COMPLETION |    26 |  1248 | 15179   (1)| 00:03:03 |
|* 13 |              INDEX SKIP SCAN              | REC0SM_STDNT_DEG_IDX        |    26 |       | 15168   (1)| 00:03:03 |
|* 14 |            SORT JOIN                      |                             |  1217 | 18255 |     4  (25)| 00:00:01 |
|  15 |             INDEX FAST FULL SCAN          | PS3RQ_GRP_TBL               |  1217 | 18255 |     3   (0)| 00:00:01 |
|* 16 |         INDEX UNIQUE SCAN                 | PS_RQ_GRP_TBL               |     1 |    15 |     0   (0)| 00:00:01 |
|* 17 |        TABLE ACCESS BY USER ROWID         | REC_SM_STDNT_DEG_COMPLETION |     1 |   180 |     1   (0)| 00:00:01 |
|* 18 |       INDEX RANGE SCAN                    | PS_RQ_MAIN_TBL              |     1 |    18 |     1   (0)| 00:00:01 |
|  19 |        SORT AGGREGATE                     |                             |     1 |    18 |            |          |
|  20 |         FIRST ROW                         |                             |     1 |    18 |     2   (0)| 00:00:01 |
|* 21 |          INDEX RANGE SCAN (MIN/MAX)       | PS_RQ_MAIN_TBL              |     1 |    18 |     2   (0)| 00:00:01 |
|* 22 |      INDEX FULL SCAN                      | PS0SMO_RDR_IMP_PLN          |     1 |    15 |     1   (0)| 00:00:01 |
|* 23 |     VIEW PUSHED PREDICATE                 |                             |     1 |    29 |    11  (19)| 00:00:01 |
|  24 |      SORT GROUP BY                        |                             |     1 |    52 |    11  (19)| 00:00:01 |
|  25 |       VIEW                                | VM_NWVW_5                   |     1 |    52 |    10  (10)| 00:00:01 |
|* 26 |        FILTER                             |                             |       |       |            |          |
|  27 |         SORT GROUP BY                     |                             |     1 |   165 |    10  (10)| 00:00:01 |
|* 28 |          FILTER                           |                             |       |       |            |          |
|  29 |           NESTED LOOPS                    |                             |     1 |   165 |     7   (0)| 00:00:01 |
|  30 |            NESTED LOOPS                   |                             |     1 |   147 |     6   (0)| 00:00:01 |
|  31 |             NESTED LOOPS                  |                             |     1 |   117 |     5   (0)| 00:00:01 |
|* 32 |              TABLE ACCESS BY INDEX ROWID  | REC_SM_STDNT_DEG_COMPLETION |     1 |    90 |     4   (0)| 00:00:01 |
|* 33 |               INDEX RANGE SCAN            | REC1SM_STDNT_DEG_IDX        |     1 |       |     3   (0)| 00:00:01 |
|* 34 |              INDEX RANGE SCAN             | PS_RQ_GRP_TBL               |     1 |    27 |     1   (0)| 00:00:01 |
|  35 |               SORT AGGREGATE              |                             |     1 |    15 |            |          |
|  36 |                FIRST ROW                  |                             |     1 |    15 |     2   (0)| 00:00:01 |
|* 37 |                 INDEX RANGE SCAN (MIN/MAX)| PS_RQ_GRP_TBL               |     1 |    15 |     2   (0)| 00:00:01 |
|* 38 |             INDEX RANGE SCAN              | PS_RQ_MAIN_TBL              |     1 |    30 |     1   (0)| 00:00:01 |
|* 39 |            INDEX RANGE SCAN               | PS_RQ_MAIN_TBL              |     1 |    18 |     1   (0)| 00:00:01 |
|* 40 |    VIEW PUSHED PREDICATE                  |                             |     1 |    29 |    11  (19)| 00:00:01 |
|  41 |     SORT GROUP BY                         |                             |     1 |    32 |    11  (19)| 00:00:01 |
|  42 |      VIEW                                 | VM_NWVW_4                   |     1 |    32 |    10  (10)| 00:00:01 |
|* 43 |       FILTER                              |                             |       |       |            |          |
|  44 |        SORT GROUP BY                      |                             |     1 |   166 |    10  (10)| 00:00:01 |
|* 45 |         FILTER                            |                             |       |       |            |          |
|* 46 |          FILTER                           |                             |       |       |            |          |
|  47 |           NESTED LOOPS                    |                             |     1 |   166 |     7   (0)| 00:00:01 |
|  48 |            NESTED LOOPS                   |                             |     1 |   148 |     6   (0)| 00:00:01 |
|  49 |             NESTED LOOPS                  |                             |     1 |   118 |     5   (0)| 00:00:01 |
|* 50 |              INDEX RANGE SCAN             | PS_RQ_GRP_TBL               |     1 |    27 |     2   (0)| 00:00:01 |
|* 51 |              TABLE ACCESS BY INDEX ROWID  | REC_SM_STDNT_DEG_COMPLETION |     1 |    91 |     3   (0)| 00:00:01 |
|* 52 |               INDEX RANGE SCAN            | REC1SM_STDNT_DEG_IDX        |     1 |       |     2   (0)| 00:00:01 |
|* 53 |             INDEX RANGE SCAN              | PS_RQ_MAIN_TBL              |     1 |    30 |     1   (0)| 00:00:01 |
|* 54 |            INDEX RANGE SCAN               | PS_RQ_MAIN_TBL              |     1 |    18 |     1   (0)| 00:00:01 |
|  55 |          SORT AGGREGATE                   |                             |     1 |    15 |            |          |
|  56 |           FIRST ROW                       |                             |     1 |    15 |     2   (0)| 00:00:01 |
|* 57 |            INDEX RANGE SCAN (MIN/MAX)     | PS_RQ_GRP_TBL               |     1 |    15 |     2   (0)| 00:00:01 |
-------------------------------------------------------------------------------------------------------------------------
call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      6.59       6.66          0          0          0           0
Execute      1      0.00       0.00          0          0          0           0
Fetch        2   1521.36    4028.91    2256624  240053408          0         841
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        4   1527.95    4035.57    2256624  240053408          0         841
Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message to client                       2        0.00          0.00
  Disk file operations I/O                        3        0.07          0.11
  db file sequential read                     10829        0.12         16.62
  direct path write temp                      72445        0.30        293.71
  direct path read temp                       72445        0.58       2234.14
  asynch descriptor resize                       22        0.00          0.00
  SQL*Net more data to client                     9        0.00          0.00
  SQL*Net message from client                     2        0.84          1.25
********************************************************************************
The current production (10.2.0.4), takes 30 seconds
PLAN_TABLE_OUTPUT
-------------------------------------------------------------------------------------------------------------------------
Plan hash value: 2178773127

------------------------------------------------------------------------------------------------------------------------
| Id  | Operation                                | Name                        | Rows  | Bytes | Cost (%CPU)| Time     |
------------------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT                         |                             |     1 |   331 | 89446   (2)| 00:17:54 |
|   1 |  SORT UNIQUE                             |                             |     1 |   331 | 89445   (2)| 00:17:54 |
|   2 |   NESTED LOOPS                           |                             |     1 |   331 | 89440   (2)| 00:17:54 |
|   3 |    NESTED LOOPS                          |                             |     1 |   316 | 89439   (2)| 00:17:54 |
|*  4 |     HASH JOIN OUTER                      |                             |     1 |   298 | 89438   (2)| 00:17:54 |
|*  5 |      HASH JOIN OUTER                     |                             |     1 |   240 | 59625   (2)| 00:11:56 |
|   6 |       NESTED LOOPS                       |                             |     1 |   182 | 29815   (2)| 00:05:58 |
|*  7 |        TABLE ACCESS FULL                 | REC_SM_STDNT_DEG_COMPLETION |     1 |   167 | 29814   (2)| 00:05:58 |
|*  8 |        INDEX FULL SCAN                   | PS0SMO_RDR_IMP_PLN          |     1 |    15 |     1   (0)| 00:00:01 |
|   9 |       VIEW                               |                             |     1 |    58 | 29809   (2)| 00:05:58 |
|  10 |        HASH GROUP BY                     |                             |     1 |    71 | 29809   (2)| 00:05:58 |
|  11 |         VIEW                             |                             |     1 |    71 | 29809   (2)| 00:05:58 |
|* 12 |          FILTER                          |                             |       |       |            |          |
|  13 |           HASH GROUP BY                  |                             |     1 |   198 | 29809   (2)| 00:05:58 |
|  14 |            NESTED LOOPS                  |                             |     1 |   198 | 29806   (2)| 00:05:58 |
|* 15 |             HASH JOIN                    |                             |     1 |   171 | 29805   (2)| 00:05:58 |
|* 16 |              HASH JOIN                   |                             |     4 |   572 | 29802   (2)| 00:05:58 |
|* 17 |               TABLE ACCESS FULL          | REC_SM_STDNT_DEG_COMPLETION |     4 |   452 | 29798   (2)| 00:05:58 |
|  18 |               INDEX FAST FULL SCAN       | PS2RQ_MAIN_TBL              |  1035 | 31050 |     3   (0)| 00:00:01 |
|  19 |              INDEX FAST FULL SCAN        | PS2RQ_MAIN_TBL              |  1035 | 28980 |     3   (0)| 00:00:01 |
|* 20 |             INDEX RANGE SCAN             | PS_RQ_GRP_TBL               |     1 |    27 |     1   (0)| 00:00:01 |
|  21 |              SORT AGGREGATE              |                             |     1 |    15 |            |          |
|  22 |               FIRST ROW                  |                             |     1 |    15 |     2   (0)| 00:00:01 |
|* 23 |                INDEX RANGE SCAN (MIN/MAX)| PS_RQ_GRP_TBL               |     1 |    15 |     2   (0)| 00:00:01 |
|  24 |      VIEW                                |                             |     1 |    58 | 29813   (2)| 00:05:58 |
|  25 |       HASH GROUP BY                      |                             |     1 |    45 | 29813   (2)| 00:05:58 |
|  26 |        VIEW                              |                             |     1 |    45 | 29813   (2)| 00:05:58 |
|* 27 |         FILTER                           |                             |       |       |            |          |
|  28 |          HASH GROUP BY                   |                             |     1 |   199 | 29813   (2)| 00:05:58 |
|  29 |           NESTED LOOPS                   |                             |     1 |   199 | 29810   (2)| 00:05:58 |
|* 30 |            HASH JOIN                     |                             |     1 |   172 | 29809   (2)| 00:05:58 |
|* 31 |             HASH JOIN                    |                             |     8 |  1152 | 29805   (2)| 00:05:58 |
|* 32 |              TABLE ACCESS FULL           | REC_SM_STDNT_DEG_COMPLETION |     7 |   798 | 29802   (2)| 00:05:58 |
|  33 |              INDEX FAST FULL SCAN        | PS2RQ_MAIN_TBL              |  1035 | 31050 |     3   (0)| 00:00:01 |
|  34 |             INDEX FAST FULL SCAN         | PS2RQ_MAIN_TBL              |  1035 | 28980 |     3   (0)| 00:00:01 |
|* 35 |            INDEX RANGE SCAN              | PS_RQ_GRP_TBL               |     1 |    27 |     1   (0)| 00:00:01 |
|  36 |             SORT AGGREGATE               |                             |     1 |    15 |            |          |
|  37 |              FIRST ROW                   |                             |     1 |    15 |     2   (0)| 00:00:01 |
|* 38 |               INDEX RANGE SCAN (MIN/MAX) | PS_RQ_GRP_TBL               |     1 |    15 |     2   (0)| 00:00:01 |
|* 39 |     INDEX RANGE SCAN                     | PS_RQ_MAIN_TBL              |     1 |    18 |     1   (0)| 00:00:01 |
|  40 |      SORT AGGREGATE                      |                             |     1 |    18 |            |          |
|  41 |       FIRST ROW                          |                             |     1 |    18 |     2   (0)| 00:00:01 |
|* 42 |        INDEX RANGE SCAN (MIN/MAX)        | PS_RQ_MAIN_TBL              |     1 |    18 |     2   (0)| 00:00:01 |
|* 43 |    INDEX RANGE SCAN                      | PS_RQ_GRP_TBL               |     1 |    15 |     1   (0)| 00:00:01 |
|  44 |     SORT AGGREGATE                       |                             |     1 |    15 |            |          |
|  45 |      FIRST ROW                           |                             |     1 |    15 |     2   (0)| 00:00:01 |
|* 46 |       INDEX RANGE SCAN (MIN/MAX)         | PS_RQ_GRP_TBL               |     1 |    15 |     2   (0)| 00:00:01 |
------------------------------------------------------------------------------------------------------------------------
call     count       cpu    elapsed       disk      query    current        rows
------- ------  -------- ---------- ---------- ---------- ----------  ----------
Parse        1      1.49       1.51          0          0          0           0
Execute      1      0.00       0.00          0          0          0           0
Fetch        2     18.25      28.63     463672     932215          0         836
------- ------  -------- ---------- ---------- ---------- ----------  ----------
total        4     19.75      30.15     463672     932215          0         836
Elapsed times include waiting on following events:
  Event waited on                             Times   Max. Wait  Total Waited
  ----------------------------------------   Waited  ----------  ------------
  SQL*Net message to client                       2        0.00          0.00
  db file scattered read                      14262        0.31         13.13
  latch: shared pool                              1        0.01          0.01
  db file sequential read                         7        0.00          0.00
  direct path write temp                        493        0.00          0.00
  direct path read temp                         493        0.00          0.00
  SQL*Net more data to client                    40        0.00          0.00
  SQL*Net message from client                     2        0.83          1.23
********************************************************************************
Published by: ngilbert on June 26, 2012 16:40

Published by: ngilbert on June 26, 2012 16:41

Hello

as is almost always the case, your bad plan is the result of messed up the cardinality estimates. The biggest problem seems to be the cardinality in steps 12 and 13 of the bad plan:

|  12 |             TABLE ACCESS BY INDEX ROWID   | REC_SM_STDNT_DEG_COMPLETION |    26 |  1248 | 15179   (1)| 00:03:03 |
|* 13 |              INDEX SKIP SCAN              | REC0SM_STDNT_DEG_IDX        |    26 |       | 15168   (1)| 00:03:03 |

that is the estimated cardinality is 26. But if we look at the map, we see that the actual number of lines is 4 orders of magnitude (!) higher than that. So of course this goes wrong from there: the optimizer uses weird join methods, wrong join order etc.

And if we look at the predicate:

13 - access("A"."ACAD_CAREER"='UGRD' AND "A"."ACAD_PROG"='UBACH' AND "A"."IMPACT_FLAG"='Y')
       filter("A"."ACAD_PLAN"="A"."REQ_ACAD_PLAN" AND "A"."ACAD_PROG"='UBACH' AND "A"."IMPACT_FLAG"='Y' AND
              "A"."ACAD_CAREER"='UGRD')

We can assume that the problem is related to the related predicates: you select lines of tables with 4 equality predicates, but 260 k lines survive this filtering. The optimizer thinks that it is closer to 26, not 260 k, but it's probably because the predicates are not really independent.

There is another thing that seems suspicious: filter predicate is redundant with the predicates of access. There is another discussion on OTN not so long ago, and it turned out to be a symptom of a bug (which makes it even more suspect, is that it was also a SKIP SCAN). See:

Re: CBO does not consider cheaper NL-Plan without guidance

Hope that was helpful.

Best regards
Nikolai

Tags: Database

Similar Questions

Maybe you are looking for