Please check below the statistics of the above query after applying
the indexes
Statistics
----------------------------------------------------------
0 recursive calls
0 db block gets
6468 consistent gets
0 physical reads
0 redo size
432 bytes sent via SQL*Net to client
584 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
114 sorts (memory)
0 sorts (disk)
1 rows processed
and the explain plan
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=156 Card=1 Bytes=28)
1 0 SORT (ORDER BY) (Cost=156 Card=1 Bytes=28)
2 1 MERGE JOIN (SEMI) (Cost=154 Card=1 Bytes=28)
3 2 SORT (JOIN) (Cost=4 Card=1 Bytes=15)
4 3 TABLE ACCESS (BY INDEX ROWID) OF 'STATEMENT' (Cost=2 Card=1
Bytes=15)
5 4 INDEX (RANGE SCAN) OF 'IND3' (NON-UNIQUE) (Cost=1 Card=1)
6 2 SORT (UNIQUE) (Cost=151 Card=1 Bytes=13)
7 6 VIEW OF 'VW_NSO_1' (Cost=149 Card=1 Bytes=13)
8 7 MERGE JOIN (Cost=149 Card=1 Bytes=91)
9 8 SORT (JOIN) (Cost=140 Card=1 Bytes=52)
10 9 MERGE JOIN (CARTESIAN) (Cost=139 Card=1 Bytes=52)
11 10 VIEW (Cost=4 Card=1 Bytes=39)
12 11 SORT (GROUP BY) (Cost=4 Card=1 Bytes=17)
13 12 TABLE ACCESS (BY INDEX ROWID) OF 'SUbjectTIVE_PRM_TRANS' (Cost=2
Card=1 Bytes=17)
14 13 INDEX (RANGE SCAN) OF 'IND4' (NON-UNIQUE) (Cost=1 Card=1)
15 10 BUFFER (SORT) (Cost=139 Card=1 Bytes=13)
16 15 VIEW
17 16 SORT (AGGREGATE)
18 17 FILTER
19 18 TABLE ACCESS (FULL) OF 'MDL_PARAMETER_TREE' (Cost=3 Card=1
Bytes=11)
20 18 FILTER
21 20 TABLE ACCESS (BY INDEX ROWID) OF 'MDL_PARAMETER_TREE' (Cost=2
Card=7 Bytes=70)
22 21 NESTED LOOPS (Cost=68 Card=1 Bytes=44)
23 22 MERGE JOIN (CARTESIAN) (Cost=6 Card=1 Bytes=34)
24 23 TABLE ACCESS (BY INDEX ROWID) OF 'SUBJECTIVE_PRM_TRANS' (Cost=2
Card=1 Bytes=20)
25 24 INDEX (RANGE SCAN) OF 'IND4' (NON-UNIQUE) (Cost=1 Card=1)
26 23 BUFFER (SORT) (Cost=64 Card=1 Bytes=14)
27 26 TABLE ACCESS (BY INDEX ROWID) OF 'MDL_PARAMETER_TREE' (Cost=64
Card=1 Bytes=14)
28 27 INDEX (RANGE SCAN) OF 'IND5' (NON-UNIQUE) (Cost=2 Card=85)
29 22 INDEX (RANGE SCAN) OF 'IND2' (NON-UNIQUE) (Cost=1 Card=92)
30 20 TABLE ACCESS (BY INDEX ROWID) OF 'MDL_PARAMETER_TREE' (Cost=64
Card=1 Bytes=41)
31 30 INDEX (RANGE SCAN) OF 'IND5' (NON-UNIQUE) (Cost=2 Card=85)
32 8 FILTER
33 32 SORT (JOIN)
34 33 VIEW (Cost=72 Card=1 Bytes=39)
35 34 SORT (GROUP BY) (Cost=8 Card=1 Bytes=31)
36 35 FILTER
37 36 HASH JOIN (Cost=6 Card=1 Bytes=31)
38 37 TABLE ACCESS (BY INDEX ROWID) OF 'SUBJECTIVE_PRM_TRANS' (Cost=2
Card=1 Bytes=24)
39 38 INDEX (RANGE SCAN) OF 'IND4' (NON-UNIQUE) (Cost=1 Card=1)
40 37 TABLE ACCESS (FULL) OF 'MDL_PARAMETER_TREE' (Cost=3 Card=85
Bytes=595)
41 36 TABLE ACCESS (BY INDEX ROWID) OF 'MDL_PARAMETER_TREE' (Cost=64
Card=1 Bytes=41)
42 41 INDEX (RANGE SCAN) OF 'IND5' (NON-UNIQUE) (Cost=2 Card=85)
Dear Sir
I have created indexes on three tables
***********************************STATEMENT******
**************************************************
-- Create/Recreate indexes
prompt:
prompt composite index on borrid,user_id:
create index IND3 on STATEMENT (BORRID,USER_ID);
*****************************SUBJECTIVE_PRM_TRANS*
************************************************** *
prompt:
prompt composite index on borrid,mdlid,user_id column:
create index IND4 on SUBJECTIVE_PRM_TRANS (BORRID,MDLID,USER_ID);
prompt:
*****************************MDL_PARAMETER_TREE***
************************************************** ***************
PROMPT:
PROMPT INDEX ON ROOTNODE COLUMN:
- Create/Recreate indexes
create index IND2 on MDL_PARAMETER_TREE (ROOTNODE);
prompt:
prompt index on MDLID COLUMN:
create index IND5 on MDL_PARAMETER_TREE (MDLID);
prompt:
After creating the indexes the output was executed in 1
milliseconds.But I would like to ask you one thing.Its seems like
after applying the indexes on the three tables the query became
faster.As well as the cost of the query is now after applying the
index is 156.Initially the cost was 28.How come there is a increase in
the cost after applying the indexes in the three table?Please help to
resolve the issue.?