Bonjour,
Pour une requete, j'obtiens 2 plan d'exécutions différents.
Version Oracle : 11.2.0.3.0
requete en question :
Je vous informe que l'index crée est un index de fonction :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 SELECT /*+ INDEX_FFS(CUST1_BLCKLST_IMF_AMC_TBL_SA CUST_BLCKLST_IMF_AMC_TBL) */ COUNT (*), SUM (OUTSTANDING_AMT) FROM CUSTOM.CUST_BLCKLST_IMF_AMC_TBL WHERE TRIM(NAT_ID) = :B1
Le plan affiché au niveau du TKPROF est le suivant :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 CREATE INDEX CUSTOM.CUST1_BLCKLST_IMF_AMC_TBL_SA ON CUSTOM.CUST_BLCKLST_IMF_AMC_TBL (TRIM("NAT_ID"))
Alors au niverau SQLPLUS, et quand je génére le plan d'exécution pour la même requete, j'obtiens un autre plan qui utilise l'index sur la table :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 SQL ID: 9dsvg3x0sjw37 Plan Hash: 2981321476 SELECT /*+ INDEX_FFS(CUST1_BLCKLST_IMF_AMC_TBL_SA CUST_BLCKLST_IMF_AMC_TBL) */ COUNT (*), SUM (OUTSTANDING_AMT) FROM CUSTOM.CUST_BLCKLST_IMF_AMC_TBL WHERE TRIM(NAT_ID) = :B1 call count cpu elapsed disk query current rows ------- ------ -------- ---------- ---------- ---------- ---------- ---------- Parse 1 0.00 0.00 0 0 0 0 Execute 117 0.01 0.01 0 0 0 0 Fetch 117 70.64 84.00 2663238 2674375 116 116 ------- ------ -------- ---------- ---------- ---------- ---------- ---------- total 235 70.65 84.01 2663238 2674375 116 116 Misses in library cache during parse: 1 Misses in library cache during execute: 1 Optimizer mode: ALL_ROWS Parsing user id: 143 (recursive depth: 1) Number of plan statistics captured: 1 Rows (1st) Rows (avg) Rows (max) Row Source Operation ---------- ---------- ---------- --------------------------------------------------- 1 1 1 SORT AGGREGATE (cr=23042 pr=22946 pw=0 time=735226 us) 1 1 1 TABLE ACCESS FULL CUST_BLCKLST_IMF_AMC_TBL (cr=23042 pr=22946 pw=0 time=735211 us cost=4458 size=119757 card=10887) Elapsed times include waiting on following events: Event waited on Times Max. Wait Total Waited ---------------------------------------- Waited ---------- ------------ direct path read 27383 0.03 12.78 ********************************************************************************
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ SQL_ID 8g7hwyturg642, child number 0 ------------------------------------- SELECT /*+ GATHER_PLAN_STATISTICS */ COUNT (*), SUM (OUTSTANDING_AMT) FROM CUSTOM.CUST_BLCKLST_IMF_AMC_TBL WHERE TRIM(NAT_ID) = 'F739736' Plan hash value: 2986778378 -------------------------------------------------------------------------------------------------------------------------------- | Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | Reads | -------------------------------------------------------------------------------------------------------------------------------- | 0 | SELECT STATEMENT | | 1 | | 1 |00:00:00.01 | 5 | 5 | PLAN_TABLE_OUTPUT ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | 1 | SORT AGGREGATE | | 1 | 1 | 1 |00:00:00.01 | 5 | 5 | | 2 | TABLE ACCESS BY INDEX ROWID| CUST_BLCKLST_IMF_AMC_TBL | 1 | 1 | 2 |00:00:00.01 | 5 | 5 | |* 3 | INDEX RANGE SCAN | CUST1_BLCKLST_IMF_AMC_TBL_SA | 1 | 1 | 2 |00:00:00.01 | 3 | 3 | -------------------------------------------------------------------------------------------------------------------------------- Predicate Information (identified by operation id): --------------------------------------------------- 3 - access("CUST_BLCKLST_IMF_AMC_TBL"."SYS_NC00022$"='F739736')
Partager