hello,
i work on apex 5.1.4, oracle 12.1.0.2.0
i have a performance problem in classic report so i decide to execute the same query in apex sql workshop
1) i execute in apex sql worskshop-->sql commands the following query with bind variable :P67_ORGA
(i set in the dialog box for P67_ORGA the value FRA404)
WITH REFER as (
select unique substr(temps,1,4) annee
,e.employe
,r.rubsrh
,t.temps
,s.scenar
from EMPLOYE_NONE_TABLE e,RUBSRH_STANDARD_table r, TEMPS_STD_MOIS_TABLE t, SCENAR_NONE_TABLE s
where t.L1 = '2018'
and SCENAR = 'LE16_B17'
and RUBSRH = 'ABS_AT_TR_MAL_PRO'
and EMPLOYE in (select /*+ PARALLEL(nomemp_code_table,4) */ employe
from nomemp_code_table
where scenar = 'LE16_B17'
and temps in (select temps from TEMPS_STD_MOIS_TABLE where L1_MOD ='2018' )
and matpres_code = 1
and employe not in (select employe from employe_none_table where etre_OD_CODE = 1)
and matorg_code in (select orga from orga_standard_table where instr(tous_niveau,'#' || :P67_ORGA || '#') >0)
and matref1_code in (select axemet from axemet_standard_table where instr(tous_niveau,'#' || 'M0001' || '#') > 0)
)
)
select (select e.employe from employe_none_table e where e.employe = emp.employe) EMP_LIB
,RUB_01
FROM (
select r.rubsrh
,r.annee
,r.scenar
,r.employe
,sum( CASE WHEN r.temps = r.annee ||'01' THEN b.budgetsal ELSE null END) RUB_01
from REFER r
left outer join budgetsal_table b on ( b.scenar=r.scenar and b.temps=r.temps and b.rubsrh=r.rubsrh and b.employe= r.employe)
group by r.rubsrh,r.annee,r.scenar,r.employe
)emp
it returns 75 rows in 114 seconds
the explain plan is
| Operation | Options | Object | Rows | Time | Cost | Bytes | Filter Predicates * | Access Predicates |
|---|
| | | 47,552 | 31 | 783,077 | 3,994,368 | | |
PX COORDINATOR | | | | | | | | |
PX SEND | QC (RANDOM) | :TQ10009 | 47,552 | 31 | 783,077 | 3,994,368 | | |
EXPRESSION EVALUATION | | | | | | | | |
HASH | GROUP BY | | 47,552 | 31 | 783,077 | 3,994,368 | | |
PX RECEIVE | | | 47,552 | 31 | 783,077 | 3,994,368 | | |
PX SEND | HASH | :TQ10008 | 47,552 | 31 | 783,077 | 3,994,368 | | |
HASH | GROUP BY | | 47,552 | 31 | 783,077 | 3,994,368 | | |
HASH JOIN | OUTER | | 452,624 | 14 | 342,487 | 38,020,416 | | "B"."SCENAR"(+) = "R"."SCENAR" AND "B"."TEMPS"(+) = "R"."TEMPS" AND "B"."RUBSRH"(+) = "R"."RUBSRH" AND "B"."EMPLOYE"(+) = "R"."EMPLOYE" |
PX RECEIVE | | | 437,117 | 1 | 14,935 | 18,358,914 | | |
PX SEND | HASH | :TQ10007 | 437,117 | 1 | 14,935 | 18,358,914 | | |
VIEW | | | 437,117 | 1 | 14,935 | 18,358,914 | | |
HASH | UNIQUE | | 437,117 | 1 | 14,935 | 92,231,687 | | |
PX RECEIVE | | | 437,117 | 1 | 14,935 | 92,231,687 | | |
PX SEND | HASH | :TQ10006 | 437,117 | 1 | 14,935 | 92,231,687 | | |
HASH | UNIQUE | | 437,117 | 1 | 14,935 | 92,231,687 | | |
HASH JOIN | RIGHT SEMI | | 1,379,085 | 1 | 14,910 | 290,986,935 | | "EMPLOYE" = "EMPLOYE" |
BUFFER | SORT | | | | | | | |
PX RECEIVE | | | 97,539 | 1 | 76 | 877,851 | | |
PX SEND | BROADCAST | :TQ10000 | 97,539 | 1 | 76 | 877,851 | | |
INDEX | FAST FULL SCAN | EMPLOYE_NONE_TABLE_IDX | 97,539 | 1 | 76 | 877,851 | | |
HASH JOIN | RIGHT SEMI | | 1,379,085 | 1 | 14,831 | 278,575,170 | | "MATREF1_CODE" = "AXEMET" |
BUFFER | SORT | | | | | | | |
PX RECEIVE | | | 498 | 1 | 7 | 25,896 | | |
PX SEND | BROADCAST | :TQ10001 | 498 | 1 | 7 | 25,896 | | |
TABLE ACCESS | FULL | AXEMET_STANDARD_TABLE | 498 | 1 | 7 | 25,896 | INSTR("TOUS_NIVEAU",'#M0001#')>0 | |
HASH JOIN | RIGHT ANTI NA | | 1,379,085 | 1 | 14,822 | 206,862,750 | | "EMPLOYE" = "EMPLOYE" |
BUFFER | SORT | | | | | | | |
PX RECEIVE | | | 1 | 1 | 535 | 22 | | |
PX SEND | BROADCAST | :TQ10002 | 1 | 1 | 535 | 22 | | |
TABLE ACCESS | FULL | EMPLOYE_NONE_TABLE | 1 | 1 | 535 | 22 | "ETRE_OD_CODE" = 1 | |
HASH JOIN | RIGHT SEMI | | 1,379,100 | 1 | 14,284 | 176,524,800 |
New comments cannot be posted to this locked post.
|